aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/window_spec.lua
Commit message (Collapse)AuthorAge
* fix(ruler)!: consistent width in last line and statuslineSébastien Hoffmann2026-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Traditionally, the ruler in the last line is one cell shorter than in the statusline, leaving the last cell of the screen blank. According to code comments, this is in order to prevent unwanted scrolling on "some" (unspecified, but presumably ancient) terminals. Berkeley vi is more specific in its `vs_modeline` function: dumb terminals with hardware scroll, SunOS 4.1.1 and Ultrix 4.2 curses. (n)curses still has a similar limitation in `(w)addstr`, but apparently only for historical reasons. Maintaining the different widths leads to awkward inconsistencies when the ruler is configured with 'rulerformat', except for the special case where it contains a top-level `%=`. Shifting the ruler in the last line to the left would be a solution, but the empty cell at the end doesn't seem to be relevant anymore. Solution: extend the ruler in the last line all the way to the right edge of the screen, just like in the statusline. The exact same amount of place will be available to the rest of the UI as before. BREAKING CHANGE: - the default ruler width is now 18 cells - the last cell of the screen is no longer empty Closes #41076
* fix(terminal): cursor moves on resize when line above is full width #40996Barrett Ruth2026-07-28
|
* fix(ui): invalid ruler items in other windows #40891Ondrej Balaz2026-07-22
| | | | | | | | | | | | | Problem: When buffer is open in multiple windows and its line count changes, any 'statusline' or 'rulerformat' items depending on it (e.g. %P) will become invalid in non-current windows because w_redr_status is only set on first change. Solution: Set w_redr_status on all windows with the buffer when the line count changes. Signed-off-by: Ondrej Balaz <blami@blami.net>
* test(harness): migrate away from magic globalsJustin M. Keyes2026-07-21
| | | | | | | | | | | | | | | | | | | | | Problem: The magic globals `it`, `describe`, etc., are more trouble than they are worth. - Hooking into `after_each` requires `getfenv()` hacks. - They confuse luals/emmylua, because the top-level `.luarc.json` isn't merged with `test/.luarc.json` (apparently a luals limitation?) - They totally defeat discoverability because the user just has to "know" about the various magic symbols. So they harm DX, which means they serve no purpose at all. Solution: - Expose the test API from `testutil`, so tests can call `t.it()`, `t.describe()`, etc., in the conventional way. - Drop `getfenv()` hacks. - Drop the `setfenv()` injection in `load_chunk`. - Drop `test/_meta.lua`.
* test: unreliable "with 'statuscolumn' wraps text" #40273Justin M. Keyes2026-06-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: flaky test: FAILED ...st_xdg_terminal/test/functional/terminal/window_spec.lua @ 175: :terminal window with 'statuscolumn' wraps text ...st_xdg_terminal/test/functional/terminal/window_spec.lua:175: Row 1 did not match. Expected: |*{121:++ 7 } | |*{121:++ 8 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR| |*{121:++ 9 }STUVWXYZ | |*{121:++10 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR| |*{121:++11 }STUVWXYZrows: 6, cols: 44 | |*{121:++12 }^ | |{5:-- TERMINAL --} | Actual: |*{121:++ 8 } | |*{121:++ 9 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR| |*{121:++10 }STUVWXYZ | |*{121:++11 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR| |*{121:++12 }STUVWXYZrows: 6, cols: 44 | |*{121:++13 }^ | |{5:-- TERMINAL --} | Solution: Relax the screen test. The `feed_data` + `tty-test` handling is racey; 'statusline' is correctly reporting the line-numbers, and that's all that matters.
* test: remove remaining use of feed_command() in terminal/ (#38069)zeertzjq2026-02-26
| | | Also deduplicate screen lines in some other tests.
* fix(terminal): handle ED 3 (clear scrollback) properly (#21412)zeertzjq2026-02-09
| | | | | | | | Problem: Terminal doesn't handle ED 3 (clear scrollback) properly. Solution: Add vterm callback for sb_clear(). Also fix another problem that scrollback lines may be duplicated when pushing to scrollback immediately after reducing window height, as can be seen in the changes to test/functional/terminal/window_spec.lua.
* fix(window): use real last buffer of closed windowSean Dewar2026-02-08
| | | | | | | | | | | | | | | | Problem: close_buffer autocmds may switch buffers at the last moment when closing a window, causing terminal_check_size to prefer the size of a closed window, or TabClosed to set an old <abuf>. Solution: use the actual last buffer, similar to what TabClosed did before. NOTE: If buffer was unloaded/deleted (not wiped), then TabClosed's <abuf> may not use it. (w_buffer = NULL) Maybe odd, but it's how it worked before anyhow. Relies on close_buffer reliably setting w_buffer to NULL if freed, otherwise buf_valid is better. Only concern I see is if the window wasn't in the window list after closing the buffer (close_buffer won't set it to NULL then), but then win_close{_othertab} should've returned earlier.
* fix(terminal): update size after closing windowSean Dewar2026-02-08
| | | | | | | | Problem: terminal's size may not update after one of its windows close. Solution: call terminal_check_size after closing a window. Disable test for Windows, as for some reason it only shows a few lines...
* test(terminal): skip flaky test on Windows (#37774)Sean Dewar2026-02-08
| | | Ref: https://github.com/neovim/neovim/pull/37758#discussion_r2778065203
* fix(terminal): reset `w_leftcol` after resizing terminalhorrifyingHorse2026-02-06
| | | | | | | Problem: windows may scroll horizontally upon resize using the old terminal size, which may be unnecessary and cause the content to be partially out-of-view. Solution: reset the horizontal scroll after resizing.
* test(tty-test): enable VTI and VTP on Windows (#37677)zeertzjq2026-02-03
|
* ci(test): bump Windows runners to windows-2025 and unskip tests (#37666)zeertzjq2026-02-03
| | | | Bumping to windows-2025 seems to fix at least one case of spaces having wrong attributes in TUI tests, which allow unskipping dozens of tests.
* fix(terminal): restore options properly when switching buffer (#37485)zeertzjq2026-01-21
|
* fix(terminal): possibly wrong wrow/wcol in active terminalSean Dewar2025-08-26
| | | | | | | | | | | | | | | | Problem: w_wrow/col calculation in terminal_check_cursor is wrong when the terminal is smaller than the window. Common when there's a larger window open with the same terminal, or just after a resize (as refresh_size is deferred). Solution: don't calculate it; validate_cursor will correct it later if it's out-of-date. Note that the toplines set for the terminal (also before this PR) assume 'nowrap' (which is set by default for terminal windows), and that no weird stuff like filler lines are around. That means, for example, it's possible for the cursor to be moved off-screen if there's wrapped lines. If this happens, it's likely update_topline will move the cursor back on screen via validate_cursor or similar, but maybe this should be handled more elegantly in the future?
* fix(terminal): patch various autocommand-related holesSean Dewar2025-08-26
| | | | | | | | | | | | | | | Problem: autocommands can cause various problems in terminal mode, which can lead to crashes, for example. Solution: fix found issues. Move some checks to terminal_check and guard against autocommands messing with things. Trigger TermEnter/Leave after terminal mode has changed/restored most state. Wipeout the correct buffer if TermLeave switches buffers and fix a UAF if it or WinScrolled/Resized frees the terminal prematurely. These changes also allow us to remove the buffer restrictions on TextChangedT; they were inadequate in stopping some issues, and WinScrolled/Resized was lacking them anyway.
* fix(terminal): update winopts and focus when switching terminalsSean Dewar2025-08-26
| | | | | | | Problem: window options and terminal focus notifications not updated when switching terminals without leaving terminal mode. Solution: update them.
* fix(terminal): check size when creating new tabpageSean Dewar2025-08-26
| | | | | | | | Problem: when creating a new tabpage with a terminal window, terminal size is not updated if there is no statusline. Solution: do not rely on last_status to implicitly call terminal_check_size as a side effect of making room for a statusline; call it directly.
* fix(terminal): avoid events messing up topline of focused terminalSean Dewar2025-08-26
| | | | | | | Problem: topline of a focused terminal window may not tail to terminal output if events scroll the window. Solution: set the topline in terminal_check_cursor.
* fix(terminal): add various missing redrawsSean Dewar2025-08-26
| | | | | | | | | | | | Problem: missing redraws when restoring saved cursorline/column, plus missing statusline and mode redraws when not updating the screen in terminal mode. Solution: schedule the redraws in a similar manner to other modes and remove some now unnecessary redrawing logic. Redraw if cursorline-related options change from entering terminal mode. This fixes test failures in later commits. WTF: TextChangedT triggers based on must_redraw, which is... fun...? Try to preserve its behaviour as much as we can for now.
* test(tui_spec): flakiness, global highlight definitions #34958luukvbaal2025-07-16
|
* 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.
* test(terminal): unskip wrap tests on windowsChristian Clason2024-09-21
| | | | These should have been unskipped again when reflow was reenabled.
* 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/`.
* 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.
* 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(terminal): set local values of window options (#29326)zeertzjq2024-06-14
|
* 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.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* fix(terminal): disable reflow againChristian Clason2024-03-14
| | | | | | | reverts https://github.com/neovim/neovim/commit/c855eee919f2d4edc9b9fa91b277454290fbabfe This setting introduces constant CI failures on macos (see https://github.com/neovim/neovim/issues/23762).
* refactor: format test/*Justin M. Keyes2024-01-03
|
* test: avoid repeated screen lines in expected stateszeertzjq2023-12-09
| | | | | | This is the command invoked repeatedly to make the changes: :%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
* test(terminal): remove unnecessary string operations (#26434)zeertzjq2023-12-07
|
* fix(terminal): check terminal size at end of screen update (#25480)zeertzjq2023-10-03
|
* feat(term): enable reflow by default (#21124)Christian Clason2023-05-24
| | | | | | | | | libvterm v0.3 supports reflow of terminal buffer when Nvim is resized Since v0.3 is now a required dependency, enable it by default to find (and fix) possible issues. 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.
* test: simplify platform detection (#21020)dundargoc2022-11-22
| | | | | Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
* test: introduce skip() #21010dundargoc2022-11-13
| | | | | | | This is essentially a convenience wrapper around the `pending()` function, similar to `skip_fragile()` but more general-purpose. Also remove `pending_win32` function as it can be replaced by `skip(iswin())`.
* ci: skip tests that fail on windowsDundar Göc2022-02-20
|
* A Mudholland Dr. RecastBjörn Linse2020-10-19
| | | | | The commit summary maybe does not make sense, but calling a function that does not wait on anything `wait()` makes even less sense.
* test/ui: update tests for new msg_grid implementationBjörn Linse2019-09-01
|
* test: improve reliability of ":terminal topline" testJustin M. Keyes2019-01-31
| | | | | | - Avoid using platform-specific shell, it failed in MINGW_64 env. - tty-test.c echos our input, which is exactly what we need for this test. - Test fails correctly if 894f6bee54e8 is reverted.
* :terminal : set topline based on window height #8325Andrew Pyatkov2019-01-29
| | | | | closes #8324 closes #8556
* window/ui: reorganize size variables, fix terminal window size with multigrid.Björn Linse2019-01-27
| | | | | | | wp->w_height_inner now contains the "inner" size, regardless if the window has been drawn yet or not. It should be used instead of wp->w_grid.Rows, for stuff that is not directly related to accessing the allocated grid memory, such like cursor movement and terminal size
* tests: terminal: Assert for SIGWINCH handling before continuingJames McCoy2017-11-12
| | | | | | | | | | | | | | | | | | | | | | | Fixes test failures like test/functional/terminal/cursor_spec.lua @ 62: terminal cursor with number column is positioned correctly when focused ./test/functional/ui/screen.lua:302: Row 2 did not match. Expected: |{7: 1 }tty ready | |*{7: 2 }{1: } | |{7: 3 } | |{7: 4 } | |{7: 5 } | |{7: 6 } | |{3:-- TERMINAL --} | Actual: |{7: 1 }tty ready | |*{7: 2 }rows: 6, cols: 46 | |{7: 3 }{1: } | |{7: 4 } | |{7: 5 } | |{7: 6 } | |{3:-- TERMINAL --} |
* test/win: partially disable :terminal resize test (#7453)Justin M. Keyes2017-10-29
|
* test: :terminal + numberwidth=9Justin M. Keyes2017-10-28
|
* terminal: Account for number column (#5310)Sam Wilson2017-10-27
|
* win: support :terminalerw72017-08-16
|
* terminal: Keep cursor position.Justin M. Keyes2017-03-01
| | | | | | Let the terminal dictate the normal-mode cursor position. This will be disorienting sometimes, but it is closer to what users expect vs always going to the last line.