From 36762a00a8010c5e14ad4347ab8287d1e8e7e064 Mon Sep 17 00:00:00 2001 From: Dan Aloni Date: Mon, 25 Mar 2019 02:16:58 +0100 Subject: signs: support multiple columns #9295 closes #990 closes #9295 - Support for multiple auto-adjusted sign columns. With this change, having more than one sign on a line, and with the 'auto' setting on 'signcolumn', extra columns will shown automatically to accomodate all the existing signs. For example, suppose we have this view: 5147 } 5148 5149 return sign->typenr; 5150 } 5151 } 5152 return 0; 5153 } 5154 We have GitGutter installed, so it tells us about modified lines that are not commmited. So let's change line 5152: 5147 } 5148 5149 return sign->typenr; 5150 } 5151 } ~ 5152 return 0; 5153 } 5154 Now we add a mark over line 5152 using 'ma' in normal mode: 5147 } 5148 5149 return sign->typenr; 5150 } 5151 } a ~ 5152 return 0; 5153 } 5154 Previously, Vim/Nvim would have picked only one of the signs, because there was no support for having multiple signs in a line. - Remove signs from deleted lines. Suppose we have highlights on a group of lines and we delete them: + 6 use std::ops::Deref; --+ 7 use std::borrow::Cow; --+ 8 use std::io::{Cursor}; 9 use proc_macro2::TokenStream; 10 use syn::export::ToTokens; --+ 11 use std::io::Write; >> 12 use std::ops::Deref; Without this change, these signs will momentarily accumulate in the sign column until the plugins wake up to refresh them. + --+ --+ --+ >> 6 Discussion: It may be better to extend the API a bit and allow this to happen for only certain types of signs. For example, VIM marks and vim-gitgutter removal signs may want to be presreved, unlike line additions and linter highlights. - 'signcolumn': support 'auto:NUM' and 'yes:NUM' settings - sort signs according to id, from lowest to highest. If you have git-gutter, vim-signature, and ALE, it would appear in this order: git-gutter - vim-signature - ALE. - recalculate size before screen update - If no space for all signs, prefer the higher ids (while keeping the rendering order from low to high). - Prevent duplicate signs. Duplicate signs were invisible to the user, before using our extended non-standard signcolumn settings. - multi signcols: fix bug related to wrapped lines. In wrapped lines, the wrapped parts of a line did not include the extra columns if they existed. The result was a misdrawing of the wrapped parts. Fix the issue by: 1. initializing the signcol counter to 0 when we are on a wrap boundary 2. allowing for the draw of spaces in that case. --- runtime/doc/options.txt | 6 +++++- runtime/doc/quickref.txt | 2 +- runtime/doc/vim_diff.txt | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index c7e247133c..361cb3da5c 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5403,10 +5403,14 @@ A jump table for the options with a short description can be found at |Q_op|. *'signcolumn'* *'scl'* 'signcolumn' 'scl' string (default "auto") local to window - Whether or not to draw the signcolumn. Valid values are: + When and how to draw the signcolumn. Valid values are: "auto" only when there is a sign to display + "auto:[1-9]" resize to accommodate multiple signs up to the + given number (maximum 9), e.g. "auto:4" "no" never "yes" always + "yes:[1-9]" always, with fixed space for signs up to the given + number (maximum 9), e.g. "yes:3" *'smartcase'* *'scs'* *'nosmartcase'* *'noscs'* diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index da064ab89b..d3d9303d3c 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -857,7 +857,7 @@ Short explanation of each option: *option-list* 'showtabline' 'stal' tells when the tab pages line is displayed 'sidescroll' 'ss' minimum number of columns to scroll horizontal 'sidescrolloff' 'siso' min. nr. of columns to left and right of cursor -'signcolumn' 'scl' when to display the sign column +'signcolumn' 'scl' when and how to display the sign column 'smartcase' 'scs' no ignore case when pattern has uppercase 'smartindent' 'si' smart autoindenting for C programs 'smarttab' 'sta' use 'shiftwidth' when inserting diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index d3ac0ba613..30d7e972c3 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -193,11 +193,15 @@ Options: 'listchars' local to window 'pumblend' pseudo-transparent popupmenu 'scrollback' + 'signcolumn' supports up to 9 dynamic/fixed columns 'statusline' supports unlimited alignment sections 'tabline' %@Func@foo%X can call any function on mouse-click 'wildoptions' `pum` flag to use popupmenu for wildmode completion 'winhighlight' window-local highlights +Signs: + Signs are removed if the associated line is deleted. + Variables: |v:event| |v:exiting| -- cgit