]> granicus.if.org Git - vim/commitdiff
patch 8.1.1466: not updating priority on existing sign v8.1.1466
authorBram Moolenaar <Bram@vim.org>
Tue, 4 Jun 2019 20:48:15 +0000 (22:48 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 4 Jun 2019 20:48:15 +0000 (22:48 +0200)
Problem:    Not updating priority on existing sign.
Solution:   Set the sign priority.  Add a test. (Yegappan Lakshmanan)

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

index c095d580c2c862a31b833431c9ee9a20d38872b1..21beaff4c727c26a99a4dfc76d0e835306f9f030 100644 (file)
@@ -8597,7 +8597,7 @@ sign_getplaced([{expr} [, {dict}]])                       *sign_getplaced()*
                        priority        sign priority
 
                The returned signs in a buffer are ordered by their line
-               number.
+               number and priority.
 
                Returns an empty list on failure or if there are no placed
                signs.
index 4f59c8f851ef282535c3ec60b096ca88972357dd..09039760ea07312e896c6233c2ed2a1abf307d75 100644 (file)
@@ -182,9 +182,9 @@ See |sign_place()| for the equivalent Vim script function.
 
                By default, the sign is assigned a default priority of 10. To
                assign a different priority value, use "priority={prio}" to
-               specify a value. The priority is used to determine the
-               highlight group used when multiple signs are placed on the
-               same line.
+               specify a value.  The priority is used to determine the sign
+               that is displayed when multiple signs are placed on the same
+               line.
 
                Examples: >
                        :sign place 5 line=3 name=sign1 file=a.py
@@ -204,7 +204,9 @@ See |sign_place()| for the equivalent Vim script function.
                it (e.g., when the debugger has stopped at a breakpoint).
 
                The optional "group={group}" attribute can be used before
-               "file=" to select a sign in a particular group.
+               "file=" to select a sign in a particular group.  The optional
+               "priority={prio}" attribute can be used to change the priority
+               of an existing sign.
 
 :sign place {id} name={name} [buffer={nr}]
                Same, but use buffer {nr}.  If the buffer argument is not
index b89bea073d84495c46a10a3132df142f3e226cd2..8f1de4af170590ad740fbfd5b80f0e855ec56730 100644 (file)
@@ -330,6 +330,7 @@ buf_addsign(
        {
            // Update an existing sign
            sign->typenr = typenr;
+           sign->priority = prio;
            return;
        }
        else if (lnum < sign->lnum)
index 426998d6d7af378ee2d4e85bd0c4d9d06521f30a..a986e122ddd3ff970700bcab332bafcecc24989c 100644 (file)
@@ -1183,6 +1183,24 @@ func Test_sign_priority()
              \ 'priority' : 10}],
              \ s[0].signs)
 
+  " Place multiple signs with same id on a line with different priority
+  call sign_place(1, '', 'sign1', 'Xsign',
+             \ {'lnum' : 5, 'priority' : 20})
+  call sign_place(1, '', 'sign2', 'Xsign',
+             \ {'lnum' : 5, 'priority' : 10})
+  let s = sign_getplaced('Xsign', {'lnum' : 5})
+  call assert_equal([
+             \ {'id' : 1, 'name' : 'sign2', 'lnum' : 5, 'group' : '',
+             \ 'priority' : 10}],
+             \ s[0].signs)
+  call sign_place(1, '', 'sign2', 'Xsign',
+             \ {'lnum' : 5, 'priority' : 5})
+  let s = sign_getplaced('Xsign', {'lnum' : 5})
+  call assert_equal([
+             \ {'id' : 1, 'name' : 'sign2', 'lnum' : 5, 'group' : '',
+             \ 'priority' : 5}],
+             \ s[0].signs)
+
   " Error case
   call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign',
              \ [])", 'E715:')
index 6fcd05737c468e866cb55438cdf987b69facf4d1..7e645896401a15f9397866eb1a2a080b92c0d062 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1466,
 /**/
     1465,
 /**/