aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-02-25 00:30:42 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-03-01 20:02:09 -0500
commit1caa85b677bc287883895558281d23e1fd55817e (patch)
tree58aa14e61ce6b2c2e075cb00631b3b560649e62d
parentca3dba482c15d127b492c2431960d154ae88c98a (diff)
downloadrneovim-1caa85b677bc287883895558281d23e1fd55817e.tar.gz
rneovim-1caa85b677bc287883895558281d23e1fd55817e.tar.bz2
rneovim-1caa85b677bc287883895558281d23e1fd55817e.zip
vim-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) https://github.com/vim/vim/commit/58a7f87c8653b4cb5b0794b6b88e2ec140d3d2c3
-rw-r--r--runtime/doc/eval.txt2
-rw-r--r--runtime/doc/sign.txt10
-rw-r--r--src/nvim/sign.c1
-rw-r--r--src/nvim/testdir/test_signs.vim18
4 files changed, 26 insertions, 5 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index c687d15689..29c5c37bcd 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -7818,7 +7818,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.
diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt
index 4e0d91dae0..e3ba4ba181 100644
--- a/runtime/doc/sign.txt
+++ b/runtime/doc/sign.txt
@@ -176,9 +176,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
@@ -198,7 +198,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
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index 23dd447744..e81d09aa4b 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -284,6 +284,7 @@ void buf_addsign(
&& sign_in_group(sign, groupname)) {
// Update an existing sign
sign->typenr = typenr;
+ sign->priority = prio;
return;
} else if (lnum < sign->lnum) {
insert_sign_by_lnum_prio(buf, prev, id, groupname, prio, lnum, typenr);
diff --git a/src/nvim/testdir/test_signs.vim b/src/nvim/testdir/test_signs.vim
index ef4b227215..806bd4b68b 100644
--- a/src/nvim/testdir/test_signs.vim
+++ b/src/nvim/testdir/test_signs.vim
@@ -1127,6 +1127,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:')