0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.1.1466: not updating priority on existing sign

Problem:    Not updating priority on existing sign.
Solution:   Set the sign priority.  Add a test. (Yegappan Lakshmanan)
This commit is contained in:
Bram Moolenaar
2019-06-04 22:48:15 +02:00
parent a37833dbd7
commit 58a7f87c86
5 changed files with 28 additions and 5 deletions

View File

@@ -8597,7 +8597,7 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()*
priority sign priority priority sign priority
The returned signs in a buffer are ordered by their line 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 Returns an empty list on failure or if there are no placed
signs. signs.

View 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 By default, the sign is assigned a default priority of 10. To
assign a different priority value, use "priority={prio}" to assign a different priority value, use "priority={prio}" to
specify a value. The priority is used to determine the specify a value. The priority is used to determine the sign
highlight group used when multiple signs are placed on the that is displayed when multiple signs are placed on the same
same line. line.
Examples: > Examples: >
:sign place 5 line=3 name=sign1 file=a.py :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). it (e.g., when the debugger has stopped at a breakpoint).
The optional "group={group}" attribute can be used before 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}] :sign place {id} name={name} [buffer={nr}]
Same, but use buffer {nr}. If the buffer argument is not Same, but use buffer {nr}. If the buffer argument is not

View File

@@ -330,6 +330,7 @@ buf_addsign(
{ {
// Update an existing sign // Update an existing sign
sign->typenr = typenr; sign->typenr = typenr;
sign->priority = prio;
return; return;
} }
else if (lnum < sign->lnum) else if (lnum < sign->lnum)

View File

@@ -1183,6 +1183,24 @@ func Test_sign_priority()
\ 'priority' : 10}], \ 'priority' : 10}],
\ s[0].signs) \ 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 " Error case
call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign', call assert_fails("call sign_place(1, 'g1', 'sign1', 'Xsign',
\ [])", 'E715:') \ [])", 'E715:')

View File

@@ -767,6 +767,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1466,
/**/ /**/
1465, 1465,
/**/ /**/