neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 16018b111788e349cc2439da07d7c19485a42ee3
parent 856d2a789236904e9b817156af7e77a75bcef452
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Wed, 10 Sep 2025 12:58:33 +0800

Merge pull request #35577 from janlazo/vim-8.1.1751

vim-patch:8.1.{1751,1920,1940},9.0.0729
Diffstat:
Mruntime/doc/rileft.txt | 5+++++
Msrc/nvim/eval.c | 21++++++++++++++++-----
Msrc/nvim/eval/funcs.c | 5+++++
Msrc/nvim/main.c | 1+
Msrc/nvim/mouse.c | 5+++--
5 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/runtime/doc/rileft.txt b/runtime/doc/rileft.txt @@ -32,6 +32,11 @@ encoded for every character (or group of characters) are not supported either as this kind of support is out of the scope of a simple addition to an existing editor (and it's not sanctioned by Unicode either). +As many people working on the code do not use the right-to-left mode, this +feature may not work in some situations. If you can describe what is wrong +and how it would work when fixed, please create an issue on github, see +|bug-report|. + ------------------------------------------------------------------------------ Highlights diff --git a/src/nvim/eval.c b/src/nvim/eval.c @@ -5481,7 +5481,8 @@ static void filter_map_blob(blob_T *blob_arg, filtermap_T filtermap, typval_T *e b_ret = rettv->vval.v_blob; } - vimvars[VV_KEY].vv_type = VAR_NUMBER; + // set_vim_var_nr() doesn't set the type + set_vim_var_type(VV_KEY, VAR_NUMBER); const VarLockStatus prev_lock = b->bv_lock; if (b->bv_lock == 0) { @@ -5532,7 +5533,8 @@ static void filter_map_string(const char *str, filtermap_T filtermap, typval_T * rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - vimvars[VV_KEY].vv_type = VAR_NUMBER; + // set_vim_var_nr() doesn't set the type + set_vim_var_type(VV_KEY, VAR_NUMBER); garray_T ga; ga_init(&ga, (int)sizeof(char), 80); @@ -5598,8 +5600,8 @@ static void filter_map_list(list_T *l, filtermap_T filtermap, const char *func_n tv_list_alloc_ret(rettv, kListLenUnknown); l_ret = rettv->vval.v_list; } - - vimvars[VV_KEY].vv_type = VAR_NUMBER; + // set_vim_var_nr() doesn't set the type + set_vim_var_type(VV_KEY, VAR_NUMBER); const VarLockStatus prev_lock = tv_list_locked(l); if (tv_list_locked(l) == VAR_UNLOCKED) { @@ -6965,14 +6967,23 @@ void set_vcount(int64_t count, int64_t count1, bool set_prevcount) vimvars[VV_COUNT1].vv_nr = count1; } +/// Set type of v: variable to the given type. +/// +/// @param[in] idx Index of variable to set. +/// @param[in] type Type to set to. +void set_vim_var_type(const VimVarIndex idx, const VarType type) +{ + vimvars[idx].vv_type = type; +} + /// Set number v: variable to the given value +/// Note that this does not set the type, use set_vim_var_type() for that. /// /// @param[in] idx Index of variable to set. /// @param[in] val Value to set to. void set_vim_var_nr(const VimVarIndex idx, const varnumber_T val) { tv_clear(&vimvars[idx].vv_tv); - vimvars[idx].vv_type = VAR_NUMBER; vimvars[idx].vv_nr = val; } diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c @@ -3344,6 +3344,9 @@ static varnumber_T indexof_blob(blob_T *b, varnumber_T startidx, typval_T *expr) } } + set_vim_var_type(VV_KEY, VAR_NUMBER); + set_vim_var_type(VV_VAL, VAR_NUMBER); + const int called_emsg_start = called_emsg; for (varnumber_T idx = startidx; idx < tv_blob_len(b); idx++) { set_vim_var_nr(VV_KEY, idx); @@ -3385,6 +3388,8 @@ static varnumber_T indexof_list(list_T *l, varnumber_T startidx, typval_T *expr) } } + set_vim_var_type(VV_KEY, VAR_NUMBER); + const int called_emsg_start = called_emsg; for (; item != NULL; item = TV_LIST_ITEM_NEXT(l, item), idx++) { set_vim_var_nr(VV_KEY, idx); diff --git a/src/nvim/main.c b/src/nvim/main.c @@ -709,6 +709,7 @@ void getout(int exitval) exitval += ex_exitval; } + set_vim_var_type(VV_EXITING, VAR_NUMBER); set_vim_var_nr(VV_EXITING, exitval); // Invoked all deferred functions in the function stack. diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c @@ -1262,7 +1262,8 @@ retnomove: return IN_UNKNOWN; } - // find the window where the row is in + // find the window where the row is in and adjust "row" and "col" to be + // relative to top-left of the window win_T *wp = mouse_find_win(&grid, &row, &col); if (wp == NULL) { return IN_UNKNOWN; @@ -1602,7 +1603,7 @@ void nv_mouse(cmdarg_T *cap) do_mouse(cap->oap, cap->cmdchar, BACKWARD, cap->count1, 0); } -/// Compute the position in the buffer line from the posn on the screen in +/// Compute the buffer line position from the screen position "rowp" / "colp" in /// window "win". /// Returns true if the position is below the last line. bool mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump)