aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.lua2
-rw-r--r--src/nvim/eval/funcs.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 231dd1f9bf..9cca9c588a 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -4387,6 +4387,8 @@ M.funcs = {
|visual-mode|, an empty list is returned.
- If {pos1}, {pos2} or {type} is an invalid string, an empty
list is returned.
+ - If {pos1} or {pos2} is a mark in different buffer, an empty
+ list is returned.
Examples: >
:xnoremap <CR>
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index b62ed557e4..b679b64bf6 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -2831,13 +2831,13 @@ static void f_getregion(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
int fnum = -1;
// NOTE: var2fpos() returns static pointer.
pos_T *fp = var2fpos(&argvars[0], true, &fnum, false);
- if (fp == NULL) {
+ if (fp == NULL || (fnum >= 0 && fnum != curbuf->b_fnum)) {
return;
}
pos_T p1 = *fp;
fp = var2fpos(&argvars[1], true, &fnum, false);
- if (fp == NULL) {
+ if (fp == NULL || (fnum >= 0 && fnum != curbuf->b_fnum)) {
return;
}
pos_T p2 = *fp;