0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.2073: when editing a buffer 'colorcolumn' may not work

Problem:    When editing a buffer 'colorcolumn' may not work.
Solution:   Set the buffer before copying option values. Call
            check_colorcolumn() after copying window options.
This commit is contained in:
Bram Moolenaar
2019-09-25 20:37:36 +02:00
parent 03ac52fc02
commit 010ee9657a
7 changed files with 76 additions and 35 deletions

View File

@@ -1738,22 +1738,22 @@ set_curbuf(buf_T *buf, int action)
static void
enter_buffer(buf_T *buf)
{
/* Copy buffer and window local option values. Not for a help buffer. */
// 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. */
// Remove all folds in the window.
clearFolding(curwin);
foldUpdateAll(curwin); /* update folds (later). */
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);
@@ -2980,9 +2980,7 @@ get_winopts(buf_T *buf)
if (p_fdls >= 0)
curwin->w_p_fdl = p_fdls;
#endif
#ifdef FEAT_SYN_HL
check_colorcolumn(curwin);
#endif
after_copy_winopt(curwin);
}
/*