-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
TUI cursor motion, SGR, and scrolling optimizations; cursor shape and terminal type recognition improvements #6816
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
mode, as the 8-bit CSI character has to be written differently in each case. | ||
Vim issues a "request version" sequence to the terminal at startup and looks | ||
at how the terminal is sending CSI. Nvim does not issue such a sequence and | ||
always uses 7-bit control sequences. |
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.
We have aspirations to change this :) Though, noting it in vim_diff.txt in the meantime is the right thing to do.
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.
Hence why I changed :help v:termresponse
rather than deleting it. (-:
src/nvim/tui/tui.c
Outdated
|
||
// Support changing cursor shape on some popular terminals. | ||
const char *vte_version = os_getenv("VTE_VERSION"); |
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.
looks like the comment is not needed now
src/nvim/tui/tui.c
Outdated
27, 91, 37, 112, 49, 37, 100, 65, 0, 27, 60, 27, 91, 34, 112, 27, 91, 53, 48, 59, 54, 34, 112, 27, 99, 27, 91, 63, 51, 108, 27, 93, | ||
82, 27, 91, 63, 49, 48, 48, 48, 108, 0, 27, 56, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 100, 0, 27, 55, 0, 10, 0, 27, 77, 0, | ||
27, 91, 48, 37, 63, 37, 112, 49, 37, 112, 54, 37, 124, 37, 116, 59, 49, 37, 59, 37, 63, 37, 112, 50, 37, 116, 59, 52, 37, 59, 37, 63, | ||
37, 112, 49, 37, 112, 51, 37, 124, 37, 116, 59, 55, 37, 59, 37, 63, |
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.
If we're going to ignore the linter here, might as well make it one big line.
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.
If it helps you, I can make the Big Block Of Numbers half as wide, but twice as deep. (-:
Regarding this change (github seems to be confused if I comment inline): + // See https://gist.github.com/XVilka/8346728 for more about this.
+ if (putty || xterm || rxvt || linuxvt || konsole || iterm || truecolor) {
+ data->unibi_ext.set_rgb_foreground = (int)unibi_add_ext_str(ut, NULL,
+ "\x1b[38;2;%p1%d;%p2%d;%p3%dm"); Previously this was set always and the nvim option 'termguicolors' controlled it. Is it possible that some truecolor-capable terminals will be missed now? What do we gain by leaving this undefined in the false case of this condition? |
Related issue: |
@tmccombs Could you test the branch? |
I hope that you were falling foul of the "everything that is not libvte supports DECSCUSR" test in the old code, @Shougo and @tmccombs. If you still have a problem after switching to this code, I am interested, in particular in what terminal or terminal emulator you see the problem on and what your Note that the design here is very much to make any further problem a terminfo problem, rather than a nvim-specific problem. Fix what the terminfo database says for problem cases, and both nvim and tmux benefit. But also there is a way to avoid the terminfo fixup that nvim does, if you actually need to. (I hope and suspect that you will not.) nvim does the fixup when the That's your local fix should you continue to experience letters |
See #6793 for discussion of the QuickBuild failure. |
I have tested the branch. |
@jdebp The travis CI failure looks legitimate, or the test needs to be updated: empty TERM appears to result in Note that we only support
|
The quickbuild failures are the same as mentioned above, not #6793 (comment). That's a good thing--at least it's deterministic :) |
With iTerm.app the cursor doesn't change shape for me. If I use a modified terminfo with |
Funny that you mention tests. (-:
@choco, if you are explicitly including the
The observed behaviour implies, to me, that your terminfo isn't actually modified as you think. Because in the case where terminfo does not have these capabilities, and genuine Xterm is not detected, nvim fakes capabilities that don't include the xterm extension for vertical bar. (It seems that iTerm2 is another supporter of the Xterm DECSUSR extensions. I'll add it in. But that is a code path that according to what you say, you aren't exercising.) |
The Interix test failure turned out to be in part a missing capability in the Interix terminfo record. |
@jdebp You're right, actually my terminfo was pretty messed up, fixed that all works perfectly, sorry for the trouble. |
This will not speed up scrolling in a window that is not the full width of the | ||
terminal. Xterm has an extra ability, not described by terminfo, to set left | ||
and right scroll margins as well. If Nvim detects that the terminal is Xterm, | ||
it will make use of this ability to speed up scrolling that is not the full |
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.
Missing words ... scrolling (in a window) that ...
?
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 think that it's not really necessary to completely repeat what was said only moments before. (-:
runtime/doc/term.txt
Outdated
it will use the "Ss" and "Se" capabilities from terminfo if they are present. | ||
|
||
Unlike Nvim, if they are not present in terminfo you will have to add them by | ||
setting the tmux "terminal-overrides" setting in $HOME/.tmux.conf . It will |
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.
Missing word . (Otherwise) it will ...
?
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.
There is no otherwise sense to either statement.
@jdebp Actually there are still a couple of issues on my machine:
App: iTerm2.app
|
src/nvim/tui/tui.c
Outdated
123, 123, 124, 124, 125, 125, 126, 126, 0, 27, 91, 90, 0, 27, 91, 63, | ||
55, 104, 0, 27, 91, 63, 55, 108, 0, 27, 40, 66, 27, 41, 48, 0, | ||
27, 91, 52, 126, 0, 26, 0, 27, 91, 68, 0, 27, 91, 67, 0, 27, | ||
|
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.
If fix_normal
is shorter than the macro string, we should not compare.
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.
Are you talking about the memcmp
call that is conditional upon a strlen
test on the line above?
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.
Comment was for this code.
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.
So, yes you were.
All of the remaining problems appear to be MacOS, and things that I cannot reproduce.
|
@jdebp Mmmmm the italics issue was probably my fault, since modifying manually the macOS standard terminfo fixed that, but the second issue I'm sure can't be caused by me. |
One thing to try @choco:
Similarly, for anyone else, the correct terminal type for GNOME Terminal is If you had to modify the vanilla MacOS terminfo, @choco, then nvim really needs to as well. Presumably you took the |
@jdebp I'm using I tried updating The same goes for |
Looks like the functional tests are passing, but CI builds are failing by
|
@SanD94 It fixes your problem? |
@Shougo I couldn't fix that. guake version : I find that ps : sorry, I am not familiar with these stuff and I don't know the meanings of |
It is the cursor shape escape code. |
It just change the cursor shape by user option. |
The issues this PR fixes basically make nvim at HEAD hard to use with multiple splits (which is common). The thread is getting quite long, can anyone make a list of the points this PR regresses on in comparison to current HEAD? If there are none, I'd suggest to merge this and do the rest in separate PRs. Anyway, thanks for all the work already, @jdebp. |
The change to |
Planning to merge this without the changes to test infrastructure (prefer #6930 for that). |
👍 for merging this soon, since I know that people are not using the nightly anymore because of that. |
Just compiled this pull request and it fixed the issue for me, which is a ^_^ Thanks! |
Yeah, it seems to be mostly via #6802 (comment) that people are affected - IIRC things were merged too quickly, and fixes for it (this PR) is taking too long. |
After this getting merged, 'termguicolors' no longer works properly with tmux 2.5 (using I can't tell from the new documentation if there's something I'm supposed to do either to my tmux config or terminfo to fix this. FWIW, |
@jamessan same thing but with alacritty instead of tmux |
see #6982 |
FEATURES: 0e873a3 Lua(Jit) built-in neovim#4411 5b32bce Windows: `:terminal` neovim#7007 7b0ceb3 UI/API: externalize cmdline neovim#7173 b67f58b UI/API: externalize wildmenu neovim#7454 b23aa1c UI: 'winhighlight' neovim#6597 17531ed UI: command-line coloring (`:help input()-highlight`) neovim#6364 244a1f9 API: execute lua directly from the remote api neovim#6704 45626de API: `get_keymap()` neovim#6236 db99982 API: `nvim_get_hl_by_name()`, `nvim_get_hl_by_id()` neovim#7082 dc68538 menu_get() function neovim#6322 9db42d4 :cquit : take an error code argument neovim#7336 9cc185d job-control: serverstart(): support ipv6 neovim#6680 1b7a9bf job-control: sockopen() neovim#6594 6efe84a clipboard: fallback to tmux clipboard neovim#6894 6016ac2 clipboard: customize clipboard with `g:clipboard` neovim#6030 3a86dd5 ruby: override ruby host via `g:ruby_host_prog` neovim#6841 16cce1a debug: $NVIM_LOG_FILE neovim#6827 0cba3da `:checkhealth` built-in, validates $VIMRUNTIME neovim#7399 FIXES: 105d680 TUI: more terminals, improve scroll/resize neovim#6816 cb912a3 :terminal : handle F1-F12, other keys neovim#7241 619838f inccommand: improve performance neovim#6949 04b3c32 inccommand: Fix matches for zero-width neovim#7487 60b1e8a inccommand: multiline, other fixes neovim#7315 f1f7f3b inccommand: Ignore leading modifiers in the command neovim#6967 1551f71 inccommand: fix 'gdefault' lockup neovim#7262 6338199 API: bufhl: support creating new groups neovim#7414 541dde3 API: allow K_EVENT during operator-pending 8c732f7 terminal: adjust for 'number' neovim#7440 5bec946 UI: preserve wildmenu during jobs/events neovim#7110 c349083 UI: disable 'lazyredraw' during ui_refresh. neovim#6259 51808a2 send FocusGained/FocusLost event instead of pseudokey neovim#7221 133f8bc shada: preserve unnamed register on restart neovim#4700 1b70a1d shada: avoid assertion on corrupt shada file neovim#6958 9f534f3 mksession: Restore tab-local working directory neovim#6859 de1084f fix buf_write() crash neovim#7140 7f76986 syntax: register 'Normal' highlight group neovim#6973 6e7a8c3 RPC: close channel if stream was closed neovim#7081 85f3084 clipboard: disallow recursion; show hint only once neovim#7203 8d1ccb6 clipboard: performance, avoid weird edge-cases neovim#7193 01487d4 'titleold' neovim#7358 01e53a5 Windows: better path-handling, separator (slash) hygiene neovim#7349 0f2873c Windows: multibyte startup arguments neovim#7060 CHANGES: 9ff0cc7 :terminal : start in normal-mode neovim#6808 032b088 lower priority of 'cursorcolumn', 'colorcolumn' neovim#7364 2a3bcd1 RPC: Don't delay notifications when request is pending neovim#6544 023f67c :terminal : Do not change 'number', 'relativenumber' neovim#6796 1ef2d76 socket.c: Disable Nagle's algorithm on TCP sockets neovim#6915 6720fe2 help: `K` tries Vim help instead of manpage neovim#3104 7068370 help, man.vim: change "outline" map to `gO` neovim#7405
This should address:
xterm
fix_terminfo()
guicursor
on more terminal types, and fall back to DECSCUSR before idiosyncratic control sequences:help term-dependent-settings
how to deal withtermguicolors
This builds upon #6801 and perhaps looks bigger than it actually is.
I do not know what the impact of this on #6798 is. It might also improve #6779.
Brief précis:
:help builtin-terms
.:help 256-color
.:help true-color
.:help xterm-resize
.:help cursor-shape
.linux
terminal type in MacOS not including complete descriptions of how to move the cursor.:help terminfo
gives pointers on how to install/update terminfo, which is simple to do.:help term-dependent-settings
gives pointers on how to settermguicolors
in case you use nvim on more than one type of terminal.See also mauke/unibilium#23 .