Patch 8.2.1556

5 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 31, 2020, 4:00:44 PM8/31/20
to vim...@googlegroups.com

Patch 8.2.1556
Problem: Cursorline highlighting always overrules sign highlighting.
Solution: Combine the highlighting, use the priority to decide how.
(closes #6812)
Files: runtime/doc/sign.txt, src/structs.h, src/drawline.c,
runtime/pack/dist/opt/termdebug/plugin/termdebug.vim,
src/testdir/test_signs.vim,
src/testdir/dumps/Test_sign_cursor_5.dump,
src/testdir/dumps/Test_sign_cursor_6.dump


*** ../vim-8.2.1555/runtime/doc/sign.txt 2019-12-12 12:49:06.000000000 +0100
--- runtime/doc/sign.txt 2020-08-31 20:59:36.791642429 +0200
***************
*** 78,90 ****
*sign-priority*
Each placed sign is assigned a priority value. When multiple signs are placed
on the same line, the attributes of the sign with the highest priority is used
! independent of the sign group. The default priority for a sign is 10. The
priority is assigned at the time of placing a sign.

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.

==============================================================================
2. Commands *sign-commands* *:sig* *:sign*

--- 78,94 ----
*sign-priority*
Each placed sign is assigned a priority value. When multiple signs are placed
on the same line, the attributes of the sign with the highest priority is used
! independently of the sign group. The default priority for a sign is 10. The
priority is assigned at the time of placing a sign.

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*

*** ../vim-8.2.1555/src/structs.h 2020-08-20 15:24:56.478101921 +0200
--- src/structs.h 2020-08-31 20:57:12.680003446 +0200
***************
*** 817,822 ****
--- 817,823 ----
char_u *sat_text;
int sat_texthl;
int sat_linehl;
+ int sat_priority;
} sign_attrs_T;

#if defined(FEAT_SIGNS) || defined(PROTO)
*** ../vim-8.2.1555/src/drawline.c 2020-06-25 22:23:45.089461529 +0200
--- src/drawline.c 2020-08-31 21:11:20.521872879 +0200
***************
*** 909,915 ****
if (!cul_screenline)
{
cul_attr = HL_ATTR(HLF_CUL);
! line_attr = cul_attr;
wp->w_last_cursorline = wp->w_cursor.lnum;
}
else
--- 909,927 ----
if (!cul_screenline)
{
cul_attr = HL_ATTR(HLF_CUL);
! # 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
*** ../vim-8.2.1555/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2019-12-11 20:50:25.000000000 +0100
--- runtime/pack/dist/opt/termdebug/plugin/termdebug.vim 2020-08-31 21:04:39.534882300 +0200
***************
*** 2,8 ****
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
! " Last Change: 2019 Dec 11
"
" WORK IN PROGRESS - Only the basics work
" Note: On MS-Windows you need a recent version of gdb. The one included with
--- 2,8 ----
"
" Author: Bram Moolenaar
" Copyright: Vim license applies, see ":help license"
! " 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
***************
*** 657,664 ****
command Source call s:GotoSourcewinOrCreateIt()
command Winbar call s:InstallWinbar()

! " TODO: can the K mapping be restored?
! nnoremap K :Evaluate<CR>

if has('menu') && &mouse != ''
call s:InstallWinbar()
--- 657,666 ----
command Source call s:GotoSourcewinOrCreateIt()
command Winbar call s:InstallWinbar()

! if !exists('g:termdebug_map_K') || g:termdebug_map_K
! let s:k_map_saved = maparg('K', 'n', 0, 1)
! nnoremap K :Evaluate<CR>
! endif

if has('menu') && &mouse != ''
call s:InstallWinbar()
***************
*** 708,714 ****
delcommand Source
delcommand Winbar

! nunmap K

if has('menu')
" Remove the WinBar entries from all windows where it was added.
--- 710,719 ----
delcommand Source
delcommand Winbar

! if exists('s:k_map_saved') && !empty(s:k_map_saved)
! call mapset('n', 0, s:k_map_saved)
! unlet s:k_map_saved
! endif

if has('menu')
" Remove the WinBar entries from all windows where it was added.
***************
*** 932,938 ****
endif
exe lnum
exe 'sign unplace ' . s:pc_id
! exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC file=' . fname
setlocal signcolumn=yes
endif
elseif !s:stopped || fname != ''
--- 937,943 ----
endif
exe lnum
exe 'sign unplace ' . s:pc_id
! exe 'sign place ' . s:pc_id . ' line=' . lnum . ' name=debugPC priority=110 file=' . fname
setlocal signcolumn=yes
endif
elseif !s:stopped || fname != ''
*** ../vim-8.2.1555/src/testdir/test_signs.vim 2020-08-12 18:50:31.887655765 +0200
--- src/testdir/test_signs.vim 2020-08-31 21:56:36.472275177 +0200
***************
*** 1762,1767 ****
--- 1762,1781 ----
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')
*** ../vim-8.2.1555/src/testdir/dumps/Test_sign_cursor_5.dump 2020-08-31 21:57:51.476038913 +0200
--- src/testdir/dumps/Test_sign_cursor_5.dump 2020-08-31 21:56:49.360234516 +0200
***************
*** 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|
*** ../vim-8.2.1555/src/testdir/dumps/Test_sign_cursor_6.dump 2020-08-31 21:57:51.480038901 +0200
--- src/testdir/dumps/Test_sign_cursor_6.dump 2020-08-31 21:56:50.408231212 +0200
***************
*** 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|
*** ../vim-8.2.1555/src/version.c 2020-08-31 21:30:28.998020213 +0200
--- src/version.c 2020-08-31 21:57:58.116018046 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1556,
/**/

--
I have to exercise early in the morning before my brain
figures out what I'm doing.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages