aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-08 06:44:57 +0800
committerGitHub <noreply@github.com>2024-03-08 06:44:57 +0800
commit5f3579e6ea12659d48e92b2126f83777908c28fc (patch)
tree4a82bc639e44680c635c04916e56da33cfdcbbbe
parent3e569d440b8e5a2b190a7013081d29cb7e04af01 (diff)
downloadrneovim-5f3579e6ea12659d48e92b2126f83777908c28fc.tar.gz
rneovim-5f3579e6ea12659d48e92b2126f83777908c28fc.tar.bz2
rneovim-5f3579e6ea12659d48e92b2126f83777908c28fc.zip
vim-patch:9.1.0157: Duplicate assignment in f_getregion() (#27766)
Problem: Duplicate assignment in f_getregion(). Solution: Remove the duplicate assignment. Also improve getregion() docs wording and fix an unrelated typo (zeertzjq) closes: vim/vim#14154 https://github.com/vim/vim/commit/0df8f93bdaea77a1afb9f4eca94fe67ec73e6df2
-rw-r--r--runtime/doc/builtin.txt8
-rw-r--r--runtime/lua/vim/_meta/vimfn.lua8
-rw-r--r--src/nvim/eval.lua8
-rw-r--r--src/nvim/eval/funcs.c3
-rw-r--r--test/old/testdir/test_undo.vim2
5 files changed, 14 insertions, 15 deletions
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 87353ff5a6..c5f3946871 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -2925,7 +2925,7 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()*
{pos1} and {pos2} must both be |List|s with four numbers.
See |getpos()| for the format of the list. It's possible
to specify positions from a different buffer, but please
- note the limitations at |getregion-notes|
+ note the limitations at |getregion-notes|.
The optional argument {opts} is a Dict and supports the
following items:
@@ -2959,9 +2959,9 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()*
- If {pos1} and {pos2} are not in the same buffer, an empty
list is returned.
- {pos1} and {pos2} must belong to a |bufloaded()| buffer.
- - It is evaluated in current window context, this makes a
- different if a buffer is displayed in a different window and
- 'virtualedit' or 'list' is set
+ - It is evaluated in current window context, which makes a
+ difference if the buffer is displayed in a window with
+ different 'virtualedit' or 'list' values.
Examples: >
:xnoremap <CR>
diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua
index 3c72d8be1d..ac25547212 100644
--- a/runtime/lua/vim/_meta/vimfn.lua
+++ b/runtime/lua/vim/_meta/vimfn.lua
@@ -3531,7 +3531,7 @@ function vim.fn.getreginfo(regname) end
--- {pos1} and {pos2} must both be |List|s with four numbers.
--- See |getpos()| for the format of the list. It's possible
--- to specify positions from a different buffer, but please
---- note the limitations at |getregion-notes|
+--- note the limitations at |getregion-notes|.
---
--- The optional argument {opts} is a Dict and supports the
--- following items:
@@ -3565,9 +3565,9 @@ function vim.fn.getreginfo(regname) end
--- - If {pos1} and {pos2} are not in the same buffer, an empty
--- list is returned.
--- - {pos1} and {pos2} must belong to a |bufloaded()| buffer.
---- - It is evaluated in current window context, this makes a
---- different if a buffer is displayed in a different window and
---- 'virtualedit' or 'list' is set
+--- - It is evaluated in current window context, which makes a
+--- difference if the buffer is displayed in a window with
+--- different 'virtualedit' or 'list' values.
---
--- Examples: >
--- :xnoremap <CR>
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 94c9af50d4..b7120d5dd5 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -4365,7 +4365,7 @@ M.funcs = {
{pos1} and {pos2} must both be |List|s with four numbers.
See |getpos()| for the format of the list. It's possible
to specify positions from a different buffer, but please
- note the limitations at |getregion-notes|
+ note the limitations at |getregion-notes|.
The optional argument {opts} is a Dict and supports the
following items:
@@ -4399,9 +4399,9 @@ M.funcs = {
- If {pos1} and {pos2} are not in the same buffer, an empty
list is returned.
- {pos1} and {pos2} must belong to a |bufloaded()| buffer.
- - It is evaluated in current window context, this makes a
- different if a buffer is displayed in a different window and
- 'virtualedit' or 'list' is set
+ - It is evaluated in current window context, which makes a
+ difference if the buffer is displayed in a window with
+ different 'virtualedit' or 'list' values.
Examples: >
:xnoremap <CR>
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 67443b66bc..2f9472f158 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -2862,7 +2862,7 @@ static void f_getregion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
return;
}
- buf_T *save_curbuf = curbuf;
+ buf_T *const save_curbuf = curbuf;
if (fnum1 != 0) {
buf_T *findbuf = buflist_findnr(fnum1);
@@ -2870,7 +2870,6 @@ static void f_getregion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (findbuf == NULL || findbuf->b_ml.ml_mfp == NULL) {
return;
}
- save_curbuf = curbuf;
curbuf = findbuf;
}
diff --git a/test/old/testdir/test_undo.vim b/test/old/testdir/test_undo.vim
index a06731cc96..a207f4f4e0 100644
--- a/test/old/testdir/test_undo.vim
+++ b/test/old/testdir/test_undo.vim
@@ -588,7 +588,7 @@ funct Test_undofile()
endif
call assert_equal('', undofile(''))
- " Test undofile() with 'undodir' set to to an existing directory.
+ " Test undofile() with 'undodir' set to an existing directory.
call mkdir('Xundodir')
set undodir=Xundodir
let cwd = getcwd()