aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tui
Commit message (Collapse)AuthorAge
* refactor: use CLEAR_FIELD and CLEAR_POINTER macros (#19709)zeertzjq2022-08-11
| | | | | | | vim-patch:8.2.0559: clearing a struct is verbose Problem: Clearing a struct is verbose. Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER(). https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83
* feat(tui): allow grid and host to disagree on ambiguous-width chars (#19686)zeertzjq2022-08-09
| | | Note: This only applies to ambiguous-width characters.
* fix(tui): add fixups for hterm family #19078Nicolas Hillegeer2022-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem ------- In #19040, I reported two things that started happening somewhen in the last three months when using neovim in hterm (the Chrome Secure Shell terminal): 1. Under certain circumstances, the window title (set by nvim [i0]) would appear over the line I was typing, corrupting the screen. 2. If I changed my $TERM from xterm-256color to the new hterm-256color (available since ncurses >=20210320), the window title corruption was gone, but pane scrolling was broken. Both problems are due to changes in the termcap files, their source of truth being the ncurses project. See "Timeline of ncurses changes" below for details. Cause: title corruption ----------------------- The title corruption when using hterm + TERM=xterm-256color can be explained by event #4 (ncurses 2022-03-12) in the ncurses timeline: The xterm-256color termcap file gained status line termcodes in ncurses 2022-03-12. These termcodes are used by Neovim to set the title when. hterm does not have a status line. Due to ncurses versions earlier than 2022-03-12 missing the xterm status line capability, Neovim manually fixed up [t0] the terminfo file if $TERM was xterm-256color. So if before Neovim manually added fsl/tsl capabilties, and after they were in the termcap file, why did hterm suddenly start getting corruption? The answer is that the termcodes for these capabilties are different when Neovim fixes them up, versus the one in the new termcap database: fsl=\E[0$} // from xterm-256color tsl=\E[2$~\E[1$}\E[%i%p1%d` // from xterm-256color fsl=\x07 // patched by Neovim tsl=\x1b]0; // patched by Neovim hterm ignores the latter, but corrupts the screen with the former. Solution: Make hterm users set hterm-256color, which lacks the new fsl/tsl codes. Also, to reduce superfluous work, stop patching in this capability when hterm is detected (even if hterm would ignore the patched version). Cause: pane corruption ---------------------- The pane corruption when using hterm + TERM=hterm-256color, but NOT when using hterm + TERM=xterm-256color can be explained by: - Neovim uses DECSLRM when available [p1] for performant scrolling. - Both the hterm-256color and xterm-256color termcap databases advertise support for DECSLRM (ncurses timeline #1, #2 and #3). - hterm does not support DESCLRM [p2] (note: it does support DESCTBM for top/bottom scrolling, but it's broken [p3] and not used by Neovim) - xterm-alikes that are not real xterm generally don't support DECSLRM either, so Neovim patches it out [p4]. When using hterm-256color, hterm is no longer considered an xterm-alike by Neovim. As a result, DECSLRM is not cleared. hterm does not support it, so corruption ensues. This is a problem with the hterm-256color termcap file, but we're stuck with it so the best we can do is patch over it. Timeline of ncurses changes --------------------------- 1. 2019-05-19: Part of the DECSLRM capability (smglr AKA set_lr_margin) added to vt420+lrmm, which xterm-256color inherits [n1] 2. 2021-03-20: hterm-256color added, inheriting xterm-256colors. [n2] 3. 2021-09-25: The *parm versions of smglr (AKA set_lr_margin) were added to vt420+lrmm [n3]. Namely: 1. smglp AKA set_left_margin_parm, and 2. smgrp AKA set_right_margin_parm 4. 2022-03-12: (new) codes for fsl, bsl and tsl added to xterm (add dec+sl to xterm-new, per patch #371 -TD) [n4] Fixes #19040. [i0]: https://github.com/neovim/neovim/blob/3a4fa22badc5595afc0a994ead965ff32ccf6c76/src/nvim/tui/tui.c#L1377 [t0]: https://github.com/neovim/neovim/blob/3a4fa22badc5595afc0a994ead965ff32ccf6c76/src/nvim/tui/tui.c#L1728,L1729 [p1]: https://github.com/neovim/neovim/blob/3a4fa22badc5595afc0a994ead965ff32ccf6c76/src/nvim/tui/tui.c#L1196 [p2]: https://bugs.chromium.org/p/chromium/issues/detail?id=1175065&q=component%3APlatform%3EApps%3EDefault%3EHterm [p3]: https://bugs.chromium.org/p/chromium/issues/detail?id=1298796&q=component%3APlatform%3EApps%3EDefault%3EHterm [p4]: https://github.com/neovim/neovim/blob/3a4fa22badc5595afc0a994ead965ff32ccf6c76/src/nvim/tui/tui.c#L1740-L1752 [n1]: https://github.com/mirror/ncurses/commit/8f6d94b8d6211a2323caef53fa4c96c475ec9a6#diff-01544c577762d3308a1d232aa7afc79acf64b9a5057f88a004df82fda89549b7R2742 [n2]: https://github.com/mirror/ncurses/commit/c2650100f80134924eda8f22cd7cc1d1d919ee3d#diff-01544c577762d3308a1d232aa7afc79acf64b9a5057f88a004df82fda89549b7R5907 [n3]: https://github.com/mirror/ncurses/commit/f6b436c4fb50275df43ea10ba9c744fe195a327d#diff-01544c577762d3308a1d232aa7afc79acf64b9a5057f88a004df82fda89549b7R2842 [n4]: https://github.com/mirror/ncurses/commit/8bf8c836fe2c28238adbd62e71f03272efe155ad#diff-01544c577762d3308a1d232aa7afc79acf64b9a5057f88a004df82fda89549b7R4828 Signed-off-by: Nicolas Hillegeer <nicolas@hillegeer.com>
* feat(tui): try terminfo for [re]set_cursor_color OSC #19255Wsevolod2022-07-07
|
* Merge pull request #19180 from zeertzjq/tui-kitty-keypadzeertzjq2022-07-07
|\ | | | | feat(tui): recognize keypad keys when using kitty keyboard protocol
| * feat(tui): recognize keypad keys when using kitty keyboard protocolerw72022-07-04
| |
* | fix(tui): resize at startup #17795Javier Lopez2022-07-04
|/ | | | | | | | | | | | | | | | | | * fix(test): screen.lua nil index When actual_rows and expected_rows are different avoid a nil index. * fix(tui): resize at startup The deleted code is not needed after 402b4e8. It caused the condition to false positive when the function was called more than once before startup (first normal mode). Being itself what set the dimension and not the user, locking the size of the screen to an incorrect size. Make got_winch an int to mitigate: tui_grid_resize changing the size of the host terminal between the signal handler and the call to sigwinch_cb. Since the actual signal handler uv__signal_handle doesn't directly call the callback, the event loop does. Fixes #17285 Fixes #15044 Fixes #11330
* refactor: remove unnecessary volatile #19210erw72022-07-04
| | | | | | libuv does not call callback functions(uv_signal_cb) directly from signal handlers. Therefore, there is no need to use volatile. Ref. https://github.com/libuv/libuv/blob/1a91b51976a1adc6972081faa78b6b70022254d3/src/unix/signal.c#L183
* refactor(highlight)!: rename attributes to match Vim (#19159)zeertzjq2022-06-30
| | | | | | | | | Ref: https://github.com/vim/vim/commit/84f546363068e4ddfe14a8a2a2322bb8d3a25417 Rename: - `underlineline` to `underdouble` - `underdot` to `underdotted` - `underdash` to `underdashed` `underdouble` also now takes higher precedence than `undercurl`.
* perf(memory): use an arena for RPC decodingbfredl2022-06-14
| | | | | | | | | drawback: tracing memory errors with ASAN is less accurate for arena allocated memory. Therefore, to start with it is being used for Object types around serialization/deserialization exclusively. This is going to have a large impact especially when TUI is refactored as a co-prosess as all UI events will be serialized and deserialized by nvim itself.
* fix(terminfo): disable smglr for vtpcon and conemu (#18855)zeertzjq2022-06-05
|
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|
* feat(terminfo): bump built-in terminfo entries (#18570)Marco Hinz2022-05-16
| | | | | | Removes NOLINT, which is pointless for the generated terminfo_defs.h. Adds `uncrustify:off`, so it is not uncrustify which complains about the same things (too long lines, no space after comma) instead.
* fix(tui): disable extended keys before exiting alternate screen (#18318)zeertzjq2022-04-30
|
* refactor(uncrustify): change rules to better align with the style guideDundar Goc2022-04-29
| | | | | | | | | | | | | Add space around arithmetic operators '+' and '-'. Remove space between back-to-back parentheses, i.e. ')(' vs. ') ('. Remove space between '((' or '))' of control statements. Add space between ')' and '{' of control statements. Remove space between function name and '(' on function declaration. Collapse empty blocks between '{' and '}'. Remove newline at the end of the file. Remove newline between 'enum' and '{'. Remove newline between '}' and ')' in a function invocation. Remove newline between '}' and 'while' of 'do' statement.
* refactor(uncrustify): format all c code under /src/nvim/Dundar Goc2022-04-29
|
* feat(tui): query terminal for CSI u support (#18181)Gregory Anders2022-04-25
| | | | | | On startup query the terminal for CSI u support and enable it using the escape sequence from kitty's progressive enhancement protocol [1]. [1]: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
* Merge pull request #18145 from bfredl/term_optbfredl2022-04-20
|\ | | | | feat(api): allow remote UI to set terminal options
| * feat(api): ui options relevant for remote TUIhlpr982022-04-17
| |
* | fix(tui): update modifyOtherKeys reporting (#18158)Gregory Anders2022-04-18
|/ | | | * Use the Eneks and Dseks terminfo attributes if they exist * Add VTE versions below 0.54.0 to the blacklist
* fix(tui)!: remove `ESC NUL` forced escape (#17198)zeertzjq2022-04-11
| | | | | | | | | | This make Nvim recognize `ESC NUL` as <M-C-Space>, as many terminal emulators (including libvterm) send <M-C-Space> as `ESC NUL`. There is already another unambiguous way to encode a `ESC` key supported by libtermkey: `ESC [ 2 7 u`, which is a `CSI u` sequence. If one still wants to use `ESC NUL` as `ESC`, they can just map <M-C-Space> to <Esc>.
* fix(tui): avoid using uninitialized memory in kitty (#17866)zeertzjq2022-03-26
|
* fix(tui): correct CSI sequence (#17844)Gregory Anders2022-03-24
| | | | | | | | | | Follow up to #17771. The sequence `CSI > 4 ; 1 m` does not enable distinguishing all available keys; notably, it excludes `<Tab>`. Using `CSI > 4 ; 2 m` tells the terminal to disambiguate *all* keys, which is much more useful. The meaning of the final parameter is documented [here][1]. [1]: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys
* feat(tui): enable CSI u keysGregory Anders2022-03-24
| | | | | | | | | | | | | | | On TUI startup write the CSI sequence that signals to the controlling terminal that Neovim supports the CSI u scheme for encoding modifiers documented in [1]. This is similar to, but distinct from, Vim's usage of the `t_TI` and `t_TE` variables to handle Xterm's `modifyOtherKeys` setting. For a longer explanation on those differences see [2]. Since Neovim uses libtermkey for key input handling, we use the CSI u encoding rather than Xterm's modifyOtherKeys encoding. [1]: http://www.leonerd.org.uk/hacks/fixterms/ [2]: https://invisible-island.net/xterm/modified-keys.html
* refactor(tinput_wait_enqueue): use rbuffer_read() when pasting (#17754)zeertzjq2022-03-19
| | | | | When pasting, all of key buffer can be consumed, and in case of phase 3 the paste event must be put exactly once, so using rbuffer_read() should be better here.
* feat(ui_client): implement async paste handlingbfredl2022-03-17
|
* feat(ui_client): pass user input to remote serverhlpr982022-03-17
|
* chore: fix typos (#17670)dundargoc2022-03-17
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(coverity): dead code and operands don't affect result #17662dundargoc2022-03-11
| | | | | | | | | | | | | | | | | | | | | * fix(coverity/349942): structurally dead code * fix(coverity/331396): operands don't affect result * fix(coverity/331393): operands don't affect result * fix(coverity/331392): operands don't affect result * fix(coverity/331384): operands don't affect result * fix(coverity/331374): operands don't affect result * fix(coverity/331372): operands don't affect result * fix(coverity/331371): operands don't affect result * fix(coverity/331364): operands don't affect result * fix(coverity/105585): operands don't affect result
* feat(tui): add support for `CSI 4 : [2,4,5] m`Kirill Chibisov2022-03-03
| | | | | | | | This commit finishes support for colored and styled underlines adding `CSI 4 : [2,4,5] m` support providing double, dashed, and dotted underlines Fixes #17362.
* feat(lua): add api and lua autocmdsTJ DeVries2022-02-27
|
* chore: fix typos (#17250)dundargoc2022-02-08
| | | | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Dani Dickstein <daniel.dickstein@gmail.com> Co-authored-by: Axel Dahlberg <git@valleymnt.com>
* vim-patch:8.2.4241: some type casts are redundantDundar Göc2022-01-30
| | | | | | | | Problem: Some type casts are redundant. Solution: Remove the type casts. (closes vim/vim#9643) https://github.com/vim/vim/commit/420fabcd4ffeaf79082a6e43db91e1d363f88f27 This is not a literal port but an equivalent one.
* chore: fix typos (#16506)dundargoc2021-12-28
| | | | | | | | | Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com> Co-authored-by: Alef Pereira <ealefpereira@gmail.com> Co-authored-by: AusCyber <willp@outlook.com.au> Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
* feat(tui): add error logging (#16615)erw72021-12-18
|
* fix(tui): end streamed paste correctly when key buffer is emptyzeertzjq2021-12-10
|
* fix(tui): extend smglr ignores to smglp and smgrp (#16239)Jan Alexander Steffens2021-11-04
| | | | | | The latter were added for xterm by ncurses 6.3 and are similarly affected. Fixes https://github.com/neovim/neovim/issues/16238
* vim-patch:8.1.0743: giving error messages is not flexibleJames McCoy2021-11-01
| | | | | | | | | Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
* refactor: uncrustify #16090dundargoc2021-10-29
|
* refactor: remove space after starDundar Göc2021-10-19
|
* refactor: format all C files under nvim/ #15977dundargoc2021-10-12
| | | | | | | | * refactor: format all C files under nvim * refactor: disable formatting for Vim-owned files: * src/nvim/indent_c.c * src/nvim/regexp.c * src/nvim/regexp_nfa.c * src/nvim/testdir/samples/memfile_test.c
* refactor: format header files with uncrustify #15877dundargoc2021-10-09
| | | | | | * refactor: format header files with uncrustify * fixup(justin): skip formatting of terminfo_defs.h * fixup: force winsock2 to be included first * fixup: simplify disable/enable directive to "uncrustify:off/on"
* fix(tui): remove dead code #15929erw72021-10-06
| | | | | Before #15889, we used our fork of libuv which supports Windows 7/8. After #15889, we use upstream libuv, which does not support Windows 7 and lacks mouse/altbuf support for Windows 8 console.
* Refactor/uncrustify (#15790)dundargoc2021-09-29
| | | | | | | | | | | | | * refactor: format with uncrustify * fixup(dundar): fix functions comments * fixup(dundar): remove space between variable and ++/-- * fixup(dundar): better workaround for macro attributes This is done to be able to better use uncrustify rules for macros * fixup(justin): make preprocessors follow neovim style guide
* refactor: format files with uncrustify #15663dundargoc2021-09-14
|
* fix: "redundant cast to the same type" #15662dundargoc2021-09-14
| | | Apply "redundant cast to the same type" fix from clangd.
* refactor: format tui/input.c with uncrustify (#15661)dundargoc2021-09-14
|
* refactor: format tui.c with uncrustify (#15640)dundargoc2021-09-14
|
* chore: PVS/V751: ignore warning #15153dundargoc2021-07-25
| | | | There's already an ignore directive but it's placed on the wrong line. This commit should correct it.
* chore(PVS/V751): tui.c, Parameter is not usedJustin M. Keyes2021-07-18
| | | | | False positive. Documentation for grid_scroll says "`cols` is always zero, reserved for future use".