-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
change defaults for fillchars 'vert' and 'fold' #7986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
So I tried to look for a solution. both the new fillchar vert and fold have an ambiguous width: our character is
the A stands for ambiguous and is thus governed by ambiwdith (see http://www.unicode.org/reports/tr11/ for the others, Na=> Narrow). So if we set it as default, it might cause problems for every user with set ambiwidth=2. Possible actions:
|
@teto What about setting a different fillchar when |
It would appear as a weird sideeffect. How is the user supposed to understand why changing ambiwidth changes his fillchar value. We could convert the error into a warning since I guess in most cases it would still be visually ok but I am not a specialist of CJK fonts. |
Let's special-case these 2 glyphs and skip the error entirely. If it causes visual problems we can revisit. |
diff:c '-' deleted lines of the 'diff' option | ||
|
||
Any one that is omitted will fall back to the default. For "stl" and | ||
"stlnc" the space will be used when there is highlighting, '^' or '=' | ||
otherwise. | ||
|
||
For "vert" and "fold", the new defaults '│' and '·' being of ambiguous | ||
width for CJK languages, nvim will fallback to the old defaults '|' and | ||
'-' when |ambiwidth| is set to "double". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we agreed not to do this. Did you find a problem when ambiwitdh is used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried quickly but any way I could think of was too complex or brittle so I followed your suggestion. I fell back on reverting to old defaults when no vert/fold fillchar is specified. I believe the behavior is not perfect but reasonable: When ambiwdith=double, users who don't set fillchars won't benefit from the new defaults (the only problem is if they try another neovim on a server for instance, they might wonder why with a same neovim version they don't see the same fillchar defaults), if they set vert or fold, the usual behavior applies. Users with ambiwidth=single will see the new defaults and nothing else changes.
The TUI dictates the use of monocell characters (for now).
0365a38
to
3de742e
Compare
Most fonts should have these by now. Both are a significant visual improvement. - Vertical connecting bar `│` is used by tmux, pstree, Windows 7 cmd.exe and nvim-qt.exe. - Middle dot `·` works on Windows 7 cmd.exe, nvim-qt.exe.
removed the default set by options.lua for fillchars because nvim won't know if it's a user setting or not.
Also for diff --git a/src/nvim/testdir/setup.vim b/src/nvim/testdir/setup.vim
index 87cf1f61637c..7d6dd0c7ce77 100644
--- a/src/nvim/testdir/setup.vim
+++ b/src/nvim/testdir/setup.vim
@@ -6,6 +6,7 @@ set directory^=.
set backspace=
set nohidden smarttab noautoindent noautoread complete-=i noruler noshowcmd
set listchars=eol:$
+set fillchars=vert:\|,fold:-
" Prevent Nvim log from writing to stderr.
let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log' |
lcs_tab1 = NUL; | ||
else | ||
fill_diff = '-'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this removed intentionally? I see it's handled by tab[i].def
now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
static struct charstab filltab[] = { | ||
{ &fill_stl, "stl" , ' ' }, | ||
{ &fill_stlnc, "stlnc", ' ' }, | ||
{ &fill_vert, "vert" , 9474 }, // '|' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the comment be │
(not |
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
see #8035 , I removed some of the micro-management, we don't need to care about whether the user set In either case, user can't |
That's why I had removed from options.lua the |
Hmm, when I tried this PR (unmodified) that didn't work. |
@@ -2377,7 +2377,7 @@ A jump table for the options with a short description can be found at |Q_op|. | |||
Only normal file name characters can be used, "/\*?[|<>" are illegal. | |||
|
|||
*'fillchars'* *'fcs'* | |||
'fillchars' 'fcs' string (default "vert:|,fold:-") | |||
'fillchars' 'fcs' string (default "vert:│,fold:·") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be empty, I think. Will fix when merging.
@@ -812,7 +812,7 @@ return { | |||
vi_def=true, | |||
redraw={'all_windows'}, | |||
varname='p_fcs', | |||
defaults={if_true={vi="vert:|,fold:-"}} | |||
defaults={if_true={vi=""}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now why this was necessary. Also added a test in #8035
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sry I wanted to test again to make sure I was not inducing you into errors but had this screen pb and not enough time to fix it. I am glad you figured it out it's a cool improvement
Merged in #8035, thanks for following up on this ! |
It was intentional to assume implicit defaults even when |
there are 2 levels of defaults, the hardcoded C
and the one from options.lua that basically call |
Conclusion from our discussion in chat: current behavior is fine and matches the documentation at
The behavior is inconsistent with 'listchars', but consistent with other Vim flags-style options which fallback to internal defaults if a flag is not explicitly mentioned. |
follow up of #7403. On top of changing the defaults for fillchar "vert", I've made cleaner the handling of defaults (benefit might be more visible with more fillchars but that might happen):
https://github.com/neovim/neovim/pull/6073/files#diff-bfacc6d8f849b9559c1c6cd5b79a5431R3412
Current tests show that this new default might generate a pb for CJK fonts. Not sure how to deal with it.