]> granicus.if.org Git - vim/commitdiff
patch 8.1.0702: ":sign place" only uses the current buffer v8.1.0702
authorBram Moolenaar <Bram@vim.org>
Mon, 7 Jan 2019 21:10:00 +0000 (22:10 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Jan 2019 21:10:00 +0000 (22:10 +0100)
Problem:    ":sign place" only uses the current buffer.
Solution:   List signs for all buffers when there is no buffer argument.
            Fix error message for invalid buffer name in sign_place().
            (Yegappan Lakshmanan, closes #3774)

runtime/doc/eval.txt
src/evalfunc.c
src/sign.c
src/testdir/test_signs.vim
src/version.c

index 8bb025ccff8ca6ea60a36e414c50fd1091b92edc..1278c97a2ca33bca9f3df42d64415863c093bda5 100644 (file)
@@ -7971,6 +7971,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.
 
index 58f58060ef78556f0f95a2963c2cb632d190e5de..cd0888b626acd143bd465cec885cf5286df75f04 100644 (file)
@@ -11462,7 +11462,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;
     }
 
index 0dfc5525d007857261fe4b6e04cd9c9844fac497..686a9437473610d3807ee49b0b1d71d0a9170a53 100644 (file)
@@ -1237,6 +1237,7 @@ 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;
@@ -1259,6 +1260,7 @@ 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)
        {
@@ -1327,7 +1329,8 @@ 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;
index 92410467b3fb1b9816bd32abff97d76e5f530cb4..07547bb2bbd0451720d9697d3814aa64aba8715b 100644 (file)
@@ -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" .
index eb7b268522159a511556f551c12e63e39522472f..13f7909e406fbb5d6f2a54832cfc1f64ba7951ca 100644 (file)
@@ -799,6 +799,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    702,
 /**/
     701,
 /**/