vim-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.
010ee9657a
This commit is contained in:
zeertzjq
2022-02-12 06:36:17 +08:00
parent 906182065b
commit 612696bedc
4 changed files with 32 additions and 9 deletions

View File

@@ -1497,6 +1497,11 @@ void set_curbuf(buf_T *buf, int action)
*/
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) {
@@ -1507,11 +1512,6 @@ void enter_buffer(buf_T *buf)
}
foldUpdateAll(curwin); // update folds (later).
// Get the buffer in the current window.
curwin->w_buffer = buf;
curbuf = buf;
curbuf->b_nwindows++;
if (curwin->w_p_diff) {
diff_buf_add(curbuf);
}