aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/eval.txt3
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/sign.c5
-rw-r--r--src/nvim/testdir/test_signs.vim12
4 files changed, 20 insertions, 2 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index c56e4cdef2..77df15bf41 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -7458,6 +7458,9 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()*
name name of the defined sign
priority sign priority
+ The returned signs in a buffer are ordered by their line
+ number.
+
Returns an empty list on failure or if there are no placed
signs.
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 6d32382497..7298f2e9a8 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -15602,7 +15602,7 @@ f_sign_place(typval_T *argvars, typval_T *rettv)
buf = tv_get_buf(&argvars[3], FALSE);
if (buf == NULL)
{
- EMSG2(_("E158: Invalid buffer name: %s"), tv_get_string(&argvars[2]));
+ EMSG2(_("E158: Invalid buffer name: %s"), tv_get_string(&argvars[3]));
goto cleanup;
}
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index 5d6c3d3326..70d32f687d 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -1203,6 +1203,7 @@ static int parse_sign_cmd_args(
char_u *arg1;
char_u *name;
char_u *filename = NULL;
+ int lnum_arg = FALSE;
// first arg could be placed sign id
arg1 = arg;
@@ -1221,6 +1222,7 @@ static int parse_sign_cmd_args(
arg += 5;
*lnum = atoi((char *)arg);
arg = skiptowhite(arg);
+ lnum_arg = TRUE;
} else if (STRNCMP(arg, "*", 1) == 0 && cmd == SIGNCMD_UNPLACE) {
if (*signid != -1) {
EMSG(_(e_invarg));
@@ -1277,7 +1279,8 @@ static int parse_sign_cmd_args(
// If the filename is not supplied for the sign place or the sign jump
// command, then use the current buffer.
- if (filename == NULL && (cmd == SIGNCMD_PLACE || cmd == SIGNCMD_JUMP)) {
+ if (filename == NULL && ((cmd == SIGNCMD_PLACE && lnum_arg)
+ || cmd == SIGNCMD_JUMP)) {
*buf = curwin->w_buffer;
}
return OK;
diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim
index ae16c49474..96f60a2ac8 100644
--- a/src/nvim/testdir/test_signs.vim
+++ b/src/nvim/testdir/test_signs.vim
@@ -663,6 +663,18 @@ func Test_sign_group()
call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
\ " line=10 id=5 name=sign1 priority=10\n", a)
+ " Place signs in more than one buffer and list the signs
+ split foo
+ set buftype=nofile
+ sign place 25 line=76 name=sign1 priority=99 file=foo
+ let a = execute('sign place')
+ call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .
+ \ " line=10 id=5 name=sign1 priority=10\n" .
+ \ "Signs for foo:\n" .
+ \ " line=76 id=25 name=sign1 priority=99\n", a)
+ close
+ bwipe foo
+
" :sign place group={group}
let a = execute('sign place group=g1')
call assert_equal("\n--- Signs ---\nSigns for Xsign:\n" .