Patch 8.1.2073
Problem: When editing a buffer 'colorcolumn' may not work.
Solution: Set the buffer before copying option values. Call
check_colorcolumn() after copying window options.
Files: src/buffer.c, src/option.c, src/proto/option.pro,
src/proto/indent.pro, src/testdir/test_highlight.vim,
src/testdir/dumps/Test_colorcolumn_1.dump
*** ../vim-8.1.2072/src/buffer.c 2019-09-07 15:45:09.973228904 +0200
--- src/buffer.c 2019-09-25 18:36:17.947261166 +0200
***************
*** 1738,1759 ****
static void
enter_buffer(buf_T *buf)
{
! /* Copy buffer and window local option values. Not for a help buffer. */
buf_copy_options(buf, BCO_ENTER | BCO_NOHELP);
if (!buf->b_help)
get_winopts(buf);
#ifdef FEAT_FOLDING
else
! /* Remove all folds in the window. */
clearFolding(curwin);
! foldUpdateAll(curwin); /* update folds (later). */
#endif
- /* Get the buffer in the current window. */
- curwin->w_buffer = buf;
- curbuf = buf;
- ++curbuf->b_nwindows;
-
#ifdef FEAT_DIFF
if (curwin->w_p_diff)
diff_buf_add(curbuf);
--- 1738,1759 ----
static void
enter_buffer(buf_T *buf)
{
! // Get the buffer in the current window.
! curwin->w_buffer = buf;
! curbuf = buf;
! ++curbuf->b_nwindows;
!
! // Copy buffer and window local option values. Not for a help buffer.
buf_copy_options(buf, BCO_ENTER | BCO_NOHELP);
if (!buf->b_help)
get_winopts(buf);
#ifdef FEAT_FOLDING
else
! // Remove all folds in the window.
clearFolding(curwin);
! foldUpdateAll(curwin); // update folds (later).
#endif
#ifdef FEAT_DIFF
if (curwin->w_p_diff)
diff_buf_add(curbuf);
***************
*** 2980,2988 ****
if (p_fdls >= 0)
curwin->w_p_fdl = p_fdls;
#endif
! #ifdef FEAT_SYN_HL
! check_colorcolumn(curwin);
! #endif
}
/*
--- 2980,2986 ----
if (p_fdls >= 0)
curwin->w_p_fdl = p_fdls;
#endif
! after_copy_winopt(curwin);
}
/*
*** ../vim-8.1.2072/src/option.c 2019-09-16 21:05:21.123911709 +0200
--- src/option.c 2019-09-25 20:28:12.543802988 +0200
***************
*** 2323,2341 ****
(void)did_set_spell_option(TRUE);
#endif
#ifdef FEAT_CMDWIN
! /* set cedit_key */
(void)check_cedit();
#endif
#ifdef FEAT_LINEBREAK
- briopt_check(curwin);
- #endif
- #ifdef FEAT_LINEBREAK
/* initialize the table for 'breakat'. */
fill_breakat_flags();
#endif
! #ifdef FEAT_SYN_HL
! fill_culopt_flags(NULL, curwin);
! #endif
}
/*
--- 2323,2336 ----
(void)did_set_spell_option(TRUE);
#endif
#ifdef FEAT_CMDWIN
! // set cedit_key
(void)check_cedit();
#endif
#ifdef FEAT_LINEBREAK
/* initialize the table for 'breakat'. */
fill_breakat_flags();
#endif
! after_copy_winopt(curwin);
}
/*
***************
*** 5528,5538 ****
{
copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
! #if defined(FEAT_LINEBREAK)
! briopt_check(wp_to);
#endif
#ifdef FEAT_SYN_HL
! fill_culopt_flags(NULL, wp_to);
#endif
}
--- 5523,5543 ----
{
copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
! after_copy_winopt(wp_to);
! }
!
! /*
! * After copying window options: update variables depending on options.
! */
! void
! after_copy_winopt(win_T *wp)
! {
! #ifdef FEAT_LINEBREAK
! briopt_check(wp);
#endif
#ifdef FEAT_SYN_HL
! fill_culopt_flags(NULL, wp);
! check_colorcolumn(wp);
#endif
}
*** ../vim-8.1.2072/src/proto/option.pro 2019-09-16 21:05:21.127911692
+0200
--- src/proto/option.pro 2019-09-25 18:37:54.058677557 +0200
***************
*** 28,33 ****
--- 28,34 ----
int findoption(char_u *arg);
int get_option_value(char_u *name, long *numval, char_u **stringval, int
opt_flags);
int get_option_value_strict(char_u *name, long *numval, char_u **stringval,
int opt_type, void *from);
+ char_u *option_iter_next(void **option, int opt_type);
long_u get_option_flags(int opt_idx);
void set_option_flag(int opt_idx, long_u flag);
void clear_option_flag(int opt_idx, long_u flag);
***************
*** 36,42 ****
int is_window_local_option(int opt_idx);
int is_hidden_option(int opt_idx);
int is_crypt_key_option(int opt_idx);
- char_u *option_iter_next(void **option, int opt_type);
char *set_option_value(char_u *name, long number, char_u *string, int
opt_flags);
char_u *get_term_code(char_u *tname);
char_u *get_highlight_default(void);
--- 37,42 ----
***************
*** 54,59 ****
--- 54,60 ----
char_u *get_option_fullname(int opt_idx);
char_u *get_equalprg(void);
void win_copy_options(win_T *wp_from, win_T *wp_to);
+ void after_copy_winopt(win_T *wp);
void copy_winopt(winopt_T *from, winopt_T *to);
void clear_winopt(winopt_T *wop);
void buf_copy_options(buf_T *buf, int flags);
***************
*** 74,92 ****
int can_bs(int what);
void save_file_ff(buf_T *buf);
int file_ff_differs(buf_T *buf, int ignore_empty);
- int tabstop_set(char_u *var, int **array);
- int tabstop_padding(colnr_T col, int ts_arg, int *vts);
- int tabstop_at(colnr_T col, int ts, int *vts);
- colnr_T tabstop_start(colnr_T col, int ts, int *vts);
- void tabstop_fromto(colnr_T start_col, colnr_T end_col, int ts_arg, int *vts,
int *ntabs, int *nspcs);
- int tabstop_eq(int *ts1, int *ts2);
- int *tabstop_copy(int *oldts);
- int tabstop_count(int *ts);
- int tabstop_first(int *ts);
- long get_sw_value(buf_T *buf);
- long get_sw_value_indent(buf_T *buf);
- long get_sw_value_col(buf_T *buf, colnr_T col);
- long get_sts_value(void);
long get_scrolloff_value(void);
long get_sidescrolloff_value(void);
void find_mps_values(int *initc, int *findc, int *backwards, int switchit);
--- 75,80 ----
*** ../vim-8.1.2072/src/proto/indent.pro 2019-08-20 20:13:40.330821936
+0200
--- src/proto/indent.pro 2019-09-25 18:38:49.386346021 +0200
***************
*** 10,13 ****
--- 10,26 ----
void do_c_expr_indent(void);
void fixthisline(int (*get_the_indent)(void));
void fix_indent(void);
+ int tabstop_set(char_u *var, int **array);
+ int tabstop_padding(colnr_T col, int ts_arg, int *vts);
+ int tabstop_at(colnr_T col, int ts, int *vts);
+ colnr_T tabstop_start(colnr_T col, int ts, int *vts);
+ void tabstop_fromto(colnr_T start_col, colnr_T end_col, int ts_arg, int *vts,
int *ntabs, int *nspcs);
+ int tabstop_eq(int *ts1, int *ts2);
+ int *tabstop_copy(int *oldts);
+ int tabstop_count(int *ts);
+ int tabstop_first(int *ts);
+ long get_sw_value(buf_T *buf);
+ long get_sw_value_indent(buf_T *buf);
+ long get_sw_value_col(buf_T *buf, colnr_T col);
+ long get_sts_value(void);
/* vim: set ft=c : */
*** ../vim-8.1.2072/src/testdir/test_highlight.vim 2019-09-23
22:17:11.763604665 +0200
--- src/testdir/test_highlight.vim 2019-09-25 20:33:30.674420055 +0200
***************
*** 618,623 ****
--- 618,648 ----
call delete('Xtest_wincolor')
endfunc
+ func Test_colorcolumn()
+ CheckScreendump
+
+ " check that setting 'colorcolumn' when entering a buffer works
+ let lines =<< trim END
+ split
+ edit X
+ call setline(1, ["1111111111","22222222222","3333333333"])
+ set nomodified
+ set colorcolumn=3,9
+ set number cursorline cursorlineopt=number
+ wincmd w
+ buf X
+ END
+ call writefile(lines, 'Xtest_colorcolumn')
+ let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10})
+ call term_sendkeys(buf, ":\<CR>")
+ call term_wait(buf)
+ call VerifyScreenDump(buf, 'Test_colorcolumn_1', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('Xtest_colorcolumn')
+ endfunc
+
" This test must come before the Test_cursorline test, as it appears this
" defines the Normal highlighting group anyway.
func Test_1_highlight_Normalgroup_exists()
*** ../vim-8.1.2072/src/testdir/dumps/Test_colorcolumn_1.dump 2019-09-25
20:35:23.645899950 +0200
--- src/testdir/dumps/Test_colorcolumn_1.dump 2019-09-25 20:33:38.346385117
+0200
***************
*** 0 ****
--- 1,10 ----
+ | +8#af5f00255#ffffff0@1|1|
|1+0#0000000&@1|1+0&#ffd7d7255|1+0&#ffffff0@4|1+0&#ffd7d7255|1+0&#ffffff0| @60
+ | +0#af5f00255&@1|2|
|2+0#0000000&@1|2+0&#ffd7d7255|2+0&#ffffff0@4|2+0&#ffd7d7255|2+0&#ffffff0@1| @59
+ | +0#af5f00255&@1|3|
|3+0#0000000&@1|3+0&#ffd7d7255|3+0&#ffffff0@4|3+0&#ffd7d7255|3+0&#ffffff0| @60
+ |~+0#4040ff13&| @73
+ |X+1#0000000&| @55|1|,|1| @11|A|l@1
+ | +8#af5f00255&@1|1|
>1+0#0000000&@1|1+0&#ffd7d7255|1+0&#ffffff0@4|1+0&#ffd7d7255|1+0&#ffffff0| @60
+ | +0#af5f00255&@1|2|
|2+0#0000000&@1|2+0&#ffd7d7255|2+0&#ffffff0@4|2+0&#ffd7d7255|2+0&#ffffff0@1| @59
+ | +0#af5f00255&@1|3|
|3+0#0000000&@1|3+0&#ffd7d7255|3+0&#ffffff0@4|3+0&#ffd7d7255|3+0&#ffffff0| @60
+ |X+3&&| @55|1|,|1| @11|A|l@1
+ |:+0&&| @73
*** ../vim-8.1.2072/src/version.c 2019-09-24 22:47:42.578098633 +0200
--- src/version.c 2019-09-25 20:35:33.137855736 +0200
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 2073,
/**/
--
Proverb: A nightingale that forgets the lyrics is a hummingbird.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/201909251838.x8PIc8Ma006382%40masaka.moolenaar.net.