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.
diff --git a/src/buffer.c b/src/buffer.c
index 81f2799..4f754f5 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1738,22 +1738,22 @@
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 @@
if (p_fdls >= 0)
curwin->w_p_fdl = p_fdls;
#endif
-#ifdef FEAT_SYN_HL
- check_colorcolumn(curwin);
-#endif
+ after_copy_winopt(curwin);
}
/*