diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-01-15 19:21:17 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-01-15 19:21:17 +0800 |
commit | d391940b9a074bca7ee82460ccaaabf46b5f2ba9 (patch) | |
tree | 28749131a7bf6984e8f41c7d72da6aeaccd3bb69 /src/nvim/cursor.c | |
parent | 574a5822023939d534d922eaa345bb7e0633d2b8 (diff) | |
download | rneovim-d391940b9a074bca7ee82460ccaaabf46b5f2ba9.tar.gz rneovim-d391940b9a074bca7ee82460ccaaabf46b5f2ba9.tar.bz2 rneovim-d391940b9a074bca7ee82460ccaaabf46b5f2ba9.zip |
vim-patch:8.2.3227: 'virtualedit' can only be set globally
Problem: 'virtualedit' can only be set globally.
Solution: Make 'virtualedit' global-local. (Gary Johnson, closes vim/vim#8638)
https://github.com/vim/vim/commit/53ba05b09075f14227f9be831a22ed16f7cc26b2
I changed some macros to unsigned integer literals to avoid compiler warnings.
Diffstat (limited to 'src/nvim/cursor.c')
-rw-r--r-- | src/nvim/cursor.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/cursor.c b/src/nvim/cursor.c index 6e2c6232d7..55f55a46b2 100644 --- a/src/nvim/cursor.c +++ b/src/nvim/cursor.c @@ -15,6 +15,7 @@ #include "nvim/memline.h" #include "nvim/memory.h" #include "nvim/move.h" +#include "nvim/option.h" #include "nvim/plines.h" #include "nvim/screen.h" #include "nvim/state.h" @@ -110,7 +111,7 @@ static int coladvance2(pos_T *pos, bool addspaces, bool finetune, colnr_T wcol_a || (State & TERM_FOCUS) || restart_edit != NUL || (VIsual_active && *p_sel != 'o') - || ((ve_flags & VE_ONEMORE) && wcol < MAXCOL); + || ((get_ve_flags() & VE_ONEMORE) && wcol < MAXCOL); line = ml_get_buf(curbuf, pos->lnum, false); if (wcol >= MAXCOL) { @@ -366,6 +367,7 @@ void check_cursor_col_win(win_T *win) colnr_T len; colnr_T oldcol = win->w_cursor.col; colnr_T oldcoladd = win->w_cursor.col + win->w_cursor.coladd; + unsigned int cur_ve_flags = get_ve_flags(); len = (colnr_T)STRLEN(ml_get_buf(win->w_buffer, win->w_cursor.lnum, false)); if (len == 0) { @@ -377,7 +379,7 @@ void check_cursor_col_win(win_T *win) * - 'virtualedit' is set */ if ((State & INSERT) || restart_edit || (VIsual_active && *p_sel != 'o') - || (ve_flags & VE_ONEMORE) + || (cur_ve_flags & VE_ONEMORE) || virtual_active()) { win->w_cursor.col = len; } else { @@ -394,7 +396,7 @@ void check_cursor_col_win(win_T *win) // line. if (oldcol == MAXCOL) { win->w_cursor.coladd = 0; - } else if (ve_flags == VE_ALL) { + } else if (cur_ve_flags == VE_ALL) { if (oldcoladd > win->w_cursor.col) { win->w_cursor.coladd = oldcoladd - win->w_cursor.col; |