diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-05-10 07:58:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-10 07:58:58 +0800 |
commit | 9aa5647e686e5420e5b9b51828ec7d55631f98ed (patch) | |
tree | 81172459aa5b8ac5c1f2e4e0b322e70267712ecd /src/nvim/buffer.c | |
parent | c55867b46d6758c4ff2e55d1bfb4cfc163182a12 (diff) | |
download | rneovim-9aa5647e686e5420e5b9b51828ec7d55631f98ed.tar.gz rneovim-9aa5647e686e5420e5b9b51828ec7d55631f98ed.tar.bz2 rneovim-9aa5647e686e5420e5b9b51828ec7d55631f98ed.zip |
vim-patch:8.2.4911: the mode #defines are not clearly named (#18499)
Problem: The mode #defines are not clearly named.
Solution: Prepend MODE_. Renumber them to put the mapped modes first.
https://github.com/vim/vim/commit/249591057b4840785c50e41dd850efb8a8faf435
A hunk from the patch depends on patch 8.2.4861, which hasn't been
ported yet, but that should be easy to notice.
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 107f61919a..8a56a08aaa 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1476,7 +1476,7 @@ void set_curbuf(buf_T *buf, int action) // Do not sync when in Insert mode and the buffer is open in // another window, might be a timer doing something in another // window. - if (prevbuf == curbuf && ((State & INSERT) == 0 || curbuf->b_nwindows <= 1)) { + if (prevbuf == curbuf && ((State & MODE_INSERT) == 0 || curbuf->b_nwindows <= 1)) { u_sync(false); } close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, @@ -3961,8 +3961,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san break; case STL_COLUMN: - num = !(State & INSERT) && empty_line - ? 0 : (int)wp->w_cursor.col + 1; + num = (State & MODE_INSERT) == 0 && empty_line ? 0 : (int)wp->w_cursor.col + 1; break; case STL_VIRTCOL: @@ -3970,7 +3969,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san colnr_T virtcol = wp->w_virtcol + 1; // Don't display %V if it's the same as %c. if (opt == STL_VIRTCOL_ALT - && (virtcol == (colnr_T)(!(State & INSERT) && empty_line + && (virtcol == (colnr_T)((State & MODE_INSERT) == 0 && empty_line ? 0 : (int)wp->w_cursor.col + 1))) { break; } @@ -4028,7 +4027,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san long l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL, false); num = (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) || l < 0 ? - 0L : l + 1 + (!(State & INSERT) && empty_line ? + 0L : l + 1 + ((State & MODE_INSERT) == 0 && empty_line ? 0 : (int)wp->w_cursor.col); break; } |