summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-08-31 22:00:05 +0200
committerBram Moolenaar <Bram@vim.org>2020-08-31 22:00:05 +0200
commit39f7aa3c3124065b50f182b1d2f7ac92a0918656 (patch)
tree238fc2ad919f9e66aca9519d9dd30585ae918d2a
parent7d6979608ee83b06ccfab2589da3047b143defae (diff)
downloadvim-git-39f7aa3c3124065b50f182b1d2f7ac92a0918656.tar.gz
patch 8.2.1556: cursorline highlighting always overrules sign highlightingv8.2.1556
Problem: Cursorline highlighting always overrules sign highlighting. Solution: Combine the highlighting, use the priority to decide how. (closes #6812)
-rw-r--r--runtime/doc/sign.txt6
-rw-r--r--runtime/pack/dist/opt/termdebug/plugin/termdebug.vim4
-rw-r--r--src/drawline.c14
-rw-r--r--src/structs.h1
-rw-r--r--src/testdir/dumps/Test_sign_cursor_5.dump6
-rw-r--r--src/testdir/dumps/Test_sign_cursor_6.dump6
-rw-r--r--src/testdir/test_signs.vim14
-rw-r--r--src/version.c2
8 files changed, 49 insertions, 4 deletions
diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt
index 1e88a62ff..46cb9b59c 100644
--- a/runtime/doc/sign.txt
+++ b/runtime/doc/sign.txt
@@ -1,4 +1,4 @@
-*sign.txt* For Vim version 8.2. Last change: 2019 Nov 30
+*sign.txt* For Vim version 8.2. Last change: 2020 Aug 31
VIM REFERENCE MANUAL by Gordon Prieur
@@ -85,6 +85,10 @@ When the line on which the sign is placed is deleted, the sign is moved to the
next line (or the last line of the buffer, if there is no next line). When
the delete is undone the sign does not move back.
+When a sign with line highlighting and 'cursorline' highlighting are both
+present, if the priority is 100 or more then the sign highlighting takes
+precedence, otherwise the 'cursorline' highlighting.
+
==============================================================================
2. Commands *sign-commands* *:sig* *:sign*
diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
index 6680b48cc..832dcf584 100644
--- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
+++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim
@@ -2,7 +2,7 @@
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
-" Last Change: 2020 Jul 12
+" Last Change: 2020 Aug 31
"
" WORK IN PROGRESS - Only the basics work
" Note: On MS-Windows you need a recent version of gdb. The one included with
@@ -937,7 +937,7 @@ func s:HandleCursor(msg)
endif
exe lnum
exe 'sign unplace ' . s:pc_id
- exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname
+ exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC priority=110 file=' . fname
setlocal signcolumn=yes
endif
elseif !s:stopped || fname != ''
diff --git a/src/drawline.c b/src/drawline.c
index fa2596510..2b72de648 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -909,7 +909,19 @@ win_line(
if (!cul_screenline)
{
cul_attr = HL_ATTR(HLF_CUL);
- line_attr = cul_attr;
+# ifdef FEAT_SIGNS
+ // Combine the 'cursorline' and sign highlighting, depending on
+ // the sign priority.
+ if (sign_present && sattr.sat_linehl > 0)
+ {
+ if (sattr.sat_priority >= 100)
+ line_attr = hl_combine_attr(cul_attr, line_attr);
+ else
+ line_attr = hl_combine_attr(line_attr, cul_attr);
+ }
+ else
+# endif
+ line_attr = cul_attr;
wp->w_last_cursorline = wp->w_cursor.lnum;
}
else
diff --git a/src/structs.h b/src/structs.h
index 38ebcf574..528c247b1 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -817,6 +817,7 @@ typedef struct sign_attrs_S {
char_u *sat_text;
int sat_texthl;
int sat_linehl;
+ int sat_priority;
} sign_attrs_T;
#if defined(FEAT_SIGNS) || defined(PROTO)
diff --git a/src/testdir/dumps/Test_sign_cursor_5.dump b/src/testdir/dumps/Test_sign_cursor_5.dump
new file mode 100644
index 000000000..2f256a507
--- /dev/null
+++ b/src/testdir/dumps/Test_sign_cursor_5.dump
@@ -0,0 +1,6 @@
+| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@1| @70
+| +0#0000e05#a8a8a8255@1>m+8#0000001#40ff4011@3| @68
+| +0#0000e05#a8a8a8255@1|y+0#0000000#ffffff0@3| @68
+|~+0#4040ff13&| @73
+|:+0#0000000&| @55|2|,|1| @10|A|l@1|
diff --git a/src/testdir/dumps/Test_sign_cursor_6.dump b/src/testdir/dumps/Test_sign_cursor_6.dump
new file mode 100644
index 000000000..efd9042a3
--- /dev/null
+++ b/src/testdir/dumps/Test_sign_cursor_6.dump
@@ -0,0 +1,6 @@
+| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|x+0#0000000#ffffff0@1| @70
+| +0#0000e05#a8a8a8255@1>m+8#0000001#ffd7ff255@3| @68
+| +0#0000e05#a8a8a8255@1|y+0#0000000#ffffff0@3| @68
+|~+0#4040ff13&| @73
+|:+0#0000000&| @55|2|,|1| @10|A|l@1|
diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim
index e8508b8d3..3ee2b49fa 100644
--- a/src/testdir/test_signs.vim
+++ b/src/testdir/test_signs.vim
@@ -1762,6 +1762,20 @@ func Test_sign_cursor_position()
call term_sendkeys(buf, ":sign unplace 10\<CR>")
call VerifyScreenDump(buf, 'Test_sign_cursor_4', {})
+ " 'cursorline' highlighting overrules sign
+ call term_sendkeys(buf, ":sign place 12 line=2 name=s2\<CR>")
+ call term_sendkeys(buf, ":set cursorline\<CR>")
+ call term_sendkeys(buf, ":hi CursorLine ctermbg=Green\<CR>")
+ call term_sendkeys(buf, "2G")
+ call term_sendkeys(buf, ":\<CR>")
+ call VerifyScreenDump(buf, 'Test_sign_cursor_5', {})
+
+ " sign highlighting overrules 'cursorline'
+ call term_sendkeys(buf, ":sign unplace 12\<CR>")
+ call term_sendkeys(buf, ":sign place 13 line=2 priority=100 name=s2\<CR>")
+ call term_sendkeys(buf, ":\<CR>")
+ call VerifyScreenDump(buf, 'Test_sign_cursor_6', {})
+
" clean up
call StopVimInTerminal(buf)
call delete('XtestSigncolumn')
diff --git a/src/version.c b/src/version.c
index f5c83beca..022c90acb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1556,
+/**/
1555,
/**/
1554,