aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal
Commit message (Collapse)AuthorAge
* test(terminal/cursor_spec): remove unnecessary busy handlers (#32321)zeertzjq2025-02-04
| | | | They are no longer necessary after #31562, as busy_start and busy_stop are no longer emitted by terminal buffers with visible cursor.
* vim-patch:9.1.1068: getchar() can't distinguish between C-I and Tab (#32295)zeertzjq2025-02-02
| | | | | | | | | | | | Problem: getchar() can't distinguish between C-I and Tab. Solution: Add {opts} to pass extra flags to getchar() and getcharstr(), with "number" and "simplify" keys. related: vim/vim#10603 closes: vim/vim#16554 https://github.com/vim/vim/commit/e0a2ab397fd13a71efec85b017d5d4d62baf7f63 Cherry-pick tv_dict_has_key() from patch 8.2.4683.
* feat(terminal): forward X1 and X2 mouse eventszeertzjq2025-01-21
| | | | | Ref: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Other-buttons
* feat(terminal): add support for kitty keyboard protocolGregory Anders2025-01-16
| | | | | | This commit adds basic support for the kitty keyboard protocol to Neovim's builtin terminal. For now only the first mode ("Disambiguate escape codes") is supported.
* Merge #32001 from MariaSolOs/consistent-namespacesJustin M. Keyes2025-01-15
|\
| * refactor: use nvim.foo.bar format for autocommand groupsMaria José Solano2025-01-14
| |
* | feat(terminal): support theme update notifications (DEC mode 2031) (#31999)Gregory Anders2025-01-14
| |
* | fix(getchar): do not simplify keycodes in terminal modebfredl2025-01-13
|/ | | | | | | | | | | | The code represents a useful pattern in normal mode where remapping `<tab>` will implicitly also remap `<c-i>` unless you remap that explicitly. This relies on the _unmapped_ behavior being identical which is not true in terminal mode, as vterm can distinguish these keys. Vim seems to entangle this with kitty keyboard mode detection which is irrelevant for us. Conditional fallbacks depending on keyboard mode could be done completely inside `vterm/` without getchar.c getting involved, I would think.
* fix(terminal): don't crash on unprintable charsbfredl2025-01-09
| | | | fixes #31897
* refactor(tests): merge n.spawn/n.spawn_argv into n.new_session #31859Justin M. Keyes2025-01-04
| | | | | | | | | | | | | | | | | Problem: - `n.spawn()` is misleading because it also connects RPC, it's not just "spawning" a process. - It's confusing that `n.spawn()` and `n.spawn_argv()` are separate. Solution: - Replace `n.spawn()`/`n.spawn_argv()` with a single function `n.new_session()`. This name aligns with the existing functions `n.set_session`/`n.get_session`. - Note: removes direct handling of `prepend_argv`, but I doubt that was important or intentional. If callers want to control use of `prepend_argv` then we should add a new flag to `test.session.Opts`. - Move `keep` to first parameter of `n.new_session()`. - Add a `merge` flag to `test.session.Opts` - Mark `_new_argv()` as private. Test should use clear/new_session/spawn_wait instead.
* test: use spawn_wait() instead of system() #31852Justin M. Keyes2025-01-04
| | | | | | | | | | | Problem: Tests that need to check `nvim` CLI behavior (no RPC session) create their own ad-hoc `system()` wrappers. Solution: - Use `n.spawn_wait` instead of `system()`. - Bonus: this also improves the tests by explicitly checking for `stdout` or `stderr`. And if a signal is raised, `ProcStream.status` will reflect it.
* feat(terminal): support grapheme clusters, including emojibfredl2025-01-02
|
* feat(clipboard)!: use OSC 52 as fallback clipboard provider (#31730)Gregory Anders2024-12-31
| | | | | | | | | | | | | | | We currently enable the OSC 52 clipboard provider by setting g:clipboard when a list of conditions are met, one of which is that $SSH_TTY must be set. We include this condition because often OSC 52 is not the best clipboard provider, so if there are "local" providers available Nvim should prefer those over OSC 52. However, if no other providers are available, Nvim should use OSC 52 even when $SSH_TTY is not set. When a user is in an SSH session then the checks for the other clipboard providers will still (typically) fail, so OSC 52 continues to be enabled by default in SSH sessions. This is marked as a breaking change because there are some cases where OSC 52 wasn't enabled before and is now (or vice versa).
* fix(terminal): set cursor cell percentage (#31703)Gregory Anders2024-12-23
| | | Fixes: https://github.com/neovim/neovim/issues/31685
* feat(jobs): jobstart(…,{term=true}), deprecate termopen() #31343Justin M. Keyes2024-12-19
| | | | | | | | | | | | Problem: `termopen` has long been a superficial wrapper around `jobstart`, and has no real purpose. Also, `vim.system` and `nvim_open_term` presumably will replace all features of `jobstart` and `termopen`, so centralizing the logic will help with that. Solution: - Introduce `eval/deprecated.c`, where all deprecated eval funcs will live. - Introduce "term" flag of `jobstart`. - Deprecate `termopen`.
* test(cursor_spec): global highlight definitions (#31613)luukvbaal2024-12-18
|
* fix(terminal): restore cursor from 'guicursor' on TermLeave (#31620)Gregory Anders2024-12-18
| | | Fixes: https://github.com/neovim/neovim/issues/31612
* feat(terminal)!: cursor shape and blink (#31562)Gregory Anders2024-12-17
| | | | | | | | | | | | | | | | | | | | | When a terminal application running inside the terminal emulator sets the cursor shape or blink status of the cursor, update the cursor in the parent terminal to match. This removes the "virtual cursor" that has been in use by the terminal emulator since the beginning. The original rationale for using the virtual cursor was to avoid having to support additional UI methods to change the cursor color for other (non-TUI) UIs, instead relying on the TermCursor and TermCursorNC highlight groups. The TermCursor highlight group is now used in the default 'guicursor' value, which has a new entry for Terminal mode. However, the TermCursorNC highlight group is no longer supported: since terminal windows now use the real cursor, when the window is not focused there is no cursor displayed in the window at all, so there is nothing to highlight. Users can still use the StatusLineTermNC highlight group to differentiate non-focused terminal windows. BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
* defaults: disable 'number', 'relativenumber', and 'signcolumn' in terminal ↵Gregory Anders2024-12-04
| | | | buffers (#31443)
* fix(tests): needing two calls to setup a screen is cringebfredl2024-11-14
| | | | | | | | | | Before calling "attach" a screen object is just a dummy container for (row, col) values whose purpose is to be sent as part of the "attach" function call anyway. Just create the screen in an attached state directly. Keep the complete (row, col, options) config together. It is still completely valid to later detach and re-attach as needed, including to another session.
* feat(terminal)!: make 'belloff' and 'visualbell' apply to terminal bell (#30859)zeertzjq2024-10-20
| | | | | | | vim-patch:8.2.4744: a terminal window can't use the bell vim-patch:8.2.4745: using wrong flag for using bell in the terminal BREAKING CHANGE: Bells from :terminal are now silent by default, unless 'belloff' option doesn't contain "term" or "all".
* fix(tui): avoid flushing buffer halfway an OSC 2 sequence (#30793)zeertzjq2024-10-15
| | | | | | Problem: Setting title while TUI buffer is almost full may cause the end of a flush to be treated as a part of an OSC 2 or OSC 0 sequence, leading to problems like invisible cursor. Solution: Make the whole sequence to set title a unibi_ext string.
* test(tui_spec): use Unicode in cursor_address test (#30807)zeertzjq2024-10-14
| | | | | | Now that #16425 is fixed, use Unicode again to reduce screen height. Unfortunately composing chars still can't be used, as it turns out that composing chars may be missing when sent separately from the base char at the last char a screen line.
* test(tui_spec): use child_exec_lua() more (#30757)zeertzjq2024-10-11
| | | It is more readable.
* test(tui_spec): better prevent race between paste and input (#30751)zeertzjq2024-10-11
| | | | | | | | | | Problem: Using a single RPC request to child server isn't enough to prevent race between nvim_paste and nvim_input. Solution: Ensure both child client and child server have processed pending events by sending an empty DCS response to the child client and waiting for TermResponse autocommand on the child server.
* feat(paste): unify cancel and error behavior (#30476)zeertzjq2024-09-24
| | | | | | | | | | | | | | | | | | | | | | | | Before this PR, the behavior of nvim_paste is: - When vim.paste() returns false, return false to the client, but treat following chunks normally (i.e. rely on the client cancelling the paste as expected). - When vim.paste() throws an error, still return true to the client, but drain the following chunks in the stream without calling vim.paste(). There are two problems with such behavior: - When vim.paste() errors, the client is still supposed to send the remaining chunks of the stream, even though they do nothing. - Having different code paths for two uncommon but similar situations complicates maintenance. This PR makes both the cancel case and the error case return false to the client and drain the remaining chunks of the stream, which, apart from sharing the same code path, is beneficial whether the client checks the return value of nvim_paste or not: - If the client checks the return value, it can avoid sending the following chunks needlessly after an error. - If the client doesn't check the return value, chunks following a cancelled chunk won't be pasted on the server regardless, which leads to less confusing behavior.
* test(tui_spec): prevent another case of race between paste and input (#30481)zeertzjq2024-09-23
| | | | | Problem: When input immediately follows end of bracketed paste, the nvim_input may be processed before the nvim_paste. Solution: Ensure some waiting after the end of a bracketed paste.
* fix(paste): improve repeating of pasted text (#30438)zeertzjq2024-09-22
| | | | | | | - Fixes 'autoindent' being applied during redo. - Makes redoing a large paste significantly faster. - Stores pasted text in the register being recorded. Fix #28561
* test(terminal): unskip wrap tests on windowsChristian Clason2024-09-21
| | | | These should have been unskipped again when reflow was reenabled.
* feat(tui): builtin UI (TUI) sets client info #30397Justin M. Keyes2024-09-18
| | | | | | | | | | | | Problem: The default builtin UI client does not declare its client info. This reduces discoverability and makes it difficult for plugins to identify the UI. Solution: - Call nvim_set_client_info after attaching, as recommended by `:help dev-ui`. - Also set the "pid" field. - Also change `ui_active()` to return a count. Not directly relevant to this commit, but will be useful later.
* refactor(tests): rename terminal/testutil.lua => testterm.lua #30372Justin M. Keyes2024-09-15
| | | | | This module is generally used by any tests that need the full Nvim TUI instead of `screen.lua`. Thus it should live in `functional/` instead of in `functional/terminal/`.
* refactor(test): rename alter_slashes, invert its behaviorJustin M. Keyes2024-09-09
| | | | | | | - `alter_slashes` belongs in `testutil.lua`, not `testnvim.lua`. - `alter_slashes` is an unusual name. Rename it to `fix_slashes`. - invert its behavior, to emphasize that `/` slashes are the preferred, pervasive convention, not `\` slashes.
* feat(defaults): popupmenu "Open in browser", "Go to definition" #30261Justin M. Keyes2024-09-05
| | | | - Use the popup to expose more features such as LSP and gx. - Move the copy/paste items lower in the menu, they are lower priority.
* fix(terminal): interrupt/got_int hangs terminal (#30056)ibhagwan2024-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | Upon `terminal_enter`, `mapped_ctrl_c` is set in order to avoid `CTRL-C` interrupts (which is proxied to the terminal process instead), `os_inchar` will then test `mapped_ctrl_c` against `State` and set `ctrl_c_interrupts=false` which prevents `process_ctrl_c` from setting `got_int=true` in a terminal state. However, if `got_int` is set outside of `process_ctrl_c`, e.g. via `interrupt()`, this will hang the neovim process as `terminal_execute` will enter an endless loop as `got_int` will never be cleared causing `safe_vgetc` to always return `Ctrl_C`. A minimal example reproducing this bug: ```vim :autocmd TermEnter * call timer_start(500, {-> interrupt()}) :terminal :startinsert ``` To fix, we make sure `got_int` is cleared inside `terminal_execute` when it detects `Ctrl_C`. Closes #20726 Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* fix(terminal): handle C0 characters in OSC terminator (#30090)Gregory Anders2024-08-19
| | | | | | | | | | | | | | When a C0 character is present in an OSC terminator (i.e. after the ESC but before a \ (0x5c) or printable character), vterm executes the control character and resets the current string fragment. If the C0 character is the final byte in the sequence, the string fragment has a zero length. However, because the VT parser is still in the "escape" state, vterm attempts to subtract 1 from the string length (to account for the escape character). When the string fragment is empty, this causes an underflow in the unsigned size variable, resulting in a buffer overflow. The fix is simple: explicitly check if the string length is non-zero before subtracting.
* feat(term): support OSC 8 hyperlinks in :terminal (#30050)Gregory Anders2024-08-15
|
* feat(term): enable reflow by default (#21124)Christian Clason2024-08-10
| | | | | | | | | | | | Problem: Contents of terminal buffer are not reflown when Nvim is resized. Solution: Enable reflow in libvterm by default. Now that libvterm is vendored, also fix "TUI rapid resize" test failures there. Note: Neovim's scrollback buffer does not support reflow (yet), so lines vanishing into the buffer due to a too small window will be restored without reflow.
* fix(tui): set id parameter in OSC 8 sequences (#29840)Gregory Anders2024-07-24
| | | | | | | | | The id parameter is used to communicate to the terminal that two URLs are the same. Without an id, the terminal must rely on heuristics to determine which cells belong together to make a single hyperlink. See the relevant section in the spec [1] for more details. [1]: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#hover-underlining-and-the-id-parameter
* fix(ui): avoid ambiguity about last chunk when flushing halfway (#29718)zeertzjq2024-07-15
|
* feat(column)!: rework 'statuscolumn' %r/l itemsLuuk van Baal2024-06-16
| | | | | | | Problem: A custom 'statuscolumn' needs to check a bunch of options and placed signs to replicate the default number column. Solution: Rework %l item to include the necessary logic to mimic the default number column. Remove now redundant %r item.
* fix(highlight): add `StatusLineTerm`/`StatusLineTermNC` to `:color vim` (#29313)Evgeni Chasnovski2024-06-14
| | | | | | | | | | | | | | | Problem: both `StatusLineTerm`/`StatusLineTermNC` are now explicitly used, but `:color vim` does not set them to the values used in Vim. This might be fine if `:color vim` is treated as "the state of default color scheme prior the big update", but it seems to be better treated as "Vim's default color scheme" (how it is documented in its header). Solution: add `StatusLineTerm`/`StatusLineTermNC` definitions to 'runtime/colors/vim.lua'. Use explicit foreground colors ('Whte'/'Black') instead of `guifg=bg` used in source, as the latter caused some problems in the past (if `Normal` is not defined, `nvim_set_hl()` can't recognize `'bg'` as the foreground value). Also realign the rest of the background conditional highlight groups.
* fix(terminal): set local values of window options (#29326)zeertzjq2024-06-14
|
* refactor(terminal): move :terminal defaults to _defaults.luaGregory Anders2024-06-12
|
* feat(terminal): add support for copying with OSC 52 in embedded terminal ↵Gregory Anders2024-06-11
| | | | | | | | | (#29117) When libvterm receives the OSC 52 escape sequence it ignores it because Nvim does not set any selection callbacks. Install selection callbacks that forward to the clipboard provider, so that setting the clipboard with OSC 52 in the embedded terminal writes to the system clipboard using the configured clipboard provider.
* fix(tui): move $COLORTERM check to _defaults.lua (#29197)Gregory Anders2024-06-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently check $COLORTERM in the TUI process to determine if the terminal supports 24 bit color (truecolor). If $COLORTERM is "truecolor" or "24bit" then we automatically assume that the terminal supports truecolor, but if $COLORTERM is set to any other value we still query the terminal. The `rgb` flag of the UI struct is a boolean which only indicates whether the UI supports truecolor, but does not have a 3rd state that we can use to represent "we don't know if the UI supports truecolor". We currently use `rgb=false` to represent this "we don't know" state, and we use XTGETTCAP and DECRQSS queries to determine at runtime if the terminal supports truecolor. However, if $COLORTERM is set to a value besides "truecolor" or "24bit" (e.g. "256" or "16) that is a clear indication that the terminal _does not_ support truecolor, so it is incorrect to treat `rgb=false` as "we don't know" in that case. Instead, in the TUI process we only check for the terminfo capabilities. This must be done in the TUI process because we do not have access to this information in the core Neovim process when `_defaults.lua` runs. If the TUI cannot determine truecolor support from terminfo alone, we set `rgb=false` to indicate "we don't know if the terminal supports truecolor yet, keep checking". When we get to `_defaults.lua`, we can then check $COLORTERM and only query the terminal if it is unset. This means that users can explicitly opt out of truecolor determination by setting `COLORTERM=256` (or similar) in their environment.
* fix(tui): reset clear_region attributes during startup #28713luukvbaal2024-05-26
| | | | | | Problem: Fix added in #28676 worked accidentally(used variables were themselves uninitialized at this point during startup) and does not always work. Solution: Reset attributes when clearing regions during startup.
* fix(tui): initialize clear attrs with current terminal backgroundLuuk van Baal2024-05-10
| | | | | | | Problem: Invalidated regions that are flushed during startup are cleared with unitialized "clear_attrs", which is perceived as flickering. Solution: Initialize "clear_attrs" with current terminal background color.
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
* fix(tui): make setcellwidths() work for non-ambiwidth chars (#28322)zeertzjq2024-04-14
|
* test: remove unnecessary nil argument to testutil (#28270)zeertzjq2024-04-11
|