| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
| |
Problem:
If a job exits with cursor at last row, the `[Process exited]` message
covers the text of that row.
Solution:
Start a new line before showing the message, like the old
`\r\n[Process exited]` did.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
position #42105
vim-patch:9.2.1114: Visual selection is not highlighted at the cursor position
Problem: In a terminal the character under the cursor is normally not
shown as part of the visual selection.
Solution: Don't set "noinvcur" in win_line() (Shane Harper).
The problem did not occur in the GUI, only in a terminal.
The name "noinvcur" ("don't invert the cursor") was misleading: the
variable did not affect the cursor, but whether the character under the
cursor could be displayed as part of the visual selection.
The "noinvcur" handling may have been meant to help during a visual
selection when Visual is shown in reverse video and the terminal draws
the cursor by inverting the character under it, as otherwise the
character under the cursor would not look highlighted like the rest of
the selection. But Vim cannot know in general how a terminal draws the
cursor, and when either the cursor is not drawn by inverting the
character under it or Visual is not shown in reverse video, the handling
just left a character of the visual selection unhighlighted.
closes: vim/vim#21317
https://github.com/vim/vim/commit/d10aab4ba6602f8f2f2576d2d62ceb63869db6fb
Co-authored-by: Shane Harper <shane@shaneharper.net>
AI-assisted
|
| |
|
|
| |
Problem: Some keys like S-Del not working in Terminal mode.
Solution: Reverse the effect of simplify_key().
|
| |
|
|
|
|
|
|
|
|
|
| |
window (#41858)
Problem: Crash when drawing double-wide character in terminal window.
(Masato Nishihata)
Solution: Check getcell() returning NULL. (issue vim/vim#6141)
https://github.com/vim/vim/commit/8b89614e69b9b2330539d0482e44f4724053e780
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
When a `:!` command runs, file timestamps are checked and W12 or
`FileChangedShell` is triggered. But not when a `:terminal` job exits.
Only `enter_buffer()` checks, so whether you get the W12 warning depends
on how you happen to return to the file: `:term` works, `:tabnew | term`
does not.
echo foo > testfile
nvim --clean testfile
" Edit the buffer, don't save it.
:!mv testfile testfile2
:tabnew | term sh
touch testfile2 && mv testfile2 testfile
exit
'autoread' is defeated because `:!mv` deletes the file, so
`should_watch()` fails and the watcher stops. `ensure_watcher()` only
re-runs on `BufReadPost`/`BufWritePost`/`OptionSet`, so nothing watches
the file when the terminal moves it back.
Solution:
Set `need_check_timestamps` on terminal-job exit, same as `:!cmd`
(`os_shell`).
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
FAILED …/terminal/buffer_spec.lua @ 348: :terminal buffer is refreshed with partial mappings in Normal mode
…/terminal/buffer_spec.lua:348: Row 2 did not match.
Expected:
|tty ready |
|*^jjjjjjjjjj |
| |
| |
| |
| |
| |
Actual:
|tty ready |
|*^jjjjjjjjj |
| |
| |
| |
| |
| |
Solution:
Increase sleep time.
|
| |
|
| |
Also, drop drag event if the mouse hasn't moved, like in gVim.
|
| | |
|
| |
|
|
| |
Problem: Memory leak when pasting '=' register in terminal.
Solution: Free the register.
|
| |
|
|
|
|
|
|
|
| |
Problem:
BufModifiedSet autocmd only triggered for current buffer during
redraw, causing delayed events when :wa writes non-current buffers.
Solution:
- Use the aucmd_defer approach to implement `Optionset modified`.
- Drop BufModifiedSet.
|
| | |
|
| |
|
|
| |
On Windows, 10000 milliseconds is sometimes not enough for 20000 lines
to be printed. Add 1 millisecond timeout for each printed line.
|
| |
|
|
|
|
|
|
| |
Problem:
If buffer update callbacks poll for uv events during terminal scrollback
refresh, new output from PTY process may lead to incorrect scrollback.
Solution:
Don't poll for output to the same terminal as the one being refreshed.
|
| |
|
|
|
|
|
| |
Problem: #38316 is a bit aggressive; we need not always leave Terminal mode if
autocmds put us in a different terminal.
Solution: don't skip entering; let terminal_check_focus handle whether we should
immediately leave.
|
| |
|
|
|
|
| |
Problem: heap-use-after-free possible when entering Terminal mode if
autocommands close the terminal.
Solution: set the refcount. Skip to the end if we must close the terminal.
|
| |
|
|
|
|
|
|
|
| |
Problem:
In autocmd examples, using "args" as the event-object name is vague and
may be confused with a user-command.
Solution:
Use "ev" as the conventional event-object name.
|
| |
|
|
|
|
|
| |
Problem: Since the "[Process exited]" msg is no longer part of buffer
contents, `jobstart`'s reuse of unmodified finished terminal buffers
does not clear the msg.
Solution: Delete the extmark if `term` is already closed.
|
| |
|
|
|
|
|
|
|
|
| |
Problem:
When a terminal process exits, "[Process Exited]" text is added
to the buffer contents.
Solution:
- Return `exitcode` field from `nvim_get_chan_info`.
- Show it in the default 'statusline'.
- Show exitcode as virtual text in the terminal buffer.
|
| |
|
| |
Also deduplicate screen lines in some other tests.
|
| |
|
|
|
|
|
| |
Problem:
Tests are using some deprecated functions.
Solution:
Replace with command, pcall_err, etc.
|
| |
|
|
| |
In buffer_spec.lua, wait for a bit more than the refresh delay.
In channel_spec.lua, retry sending lines on Windows.
|
| |
|
|
|
|
|
|
|
|
| |
When the terminal process is suspended, putting cursor at bottom-left
hints that pressing a key will change the suspended state. However, when
returning to Normal mode, the user is more likely to interact with the
actual terminal output (e.g. copying it), so it's better to put cursor
at the old position which should be closer to the output.
Also, using is_focused() to check for mode is confusing. Just check
`State & MODE_TERMINAL` instead.
|
| |
|
|
|
|
|
|
|
|
|
| |
Problem: Resuming terminal process doesn't work with command in fish.
Solution: Send SIGCONT to the entire process group.
Use killpg() like what bash and zsh do on `fg`:
https://cgit.git.savannah.gnu.org/cgit/bash.git/tree/jobs.c?id=637f5c8696a6adc9b4519f1cd74aa78492266b7f#n3928
https://sourceforge.net/p/zsh/code/ci/77045ef899e53b9598bebc5a41db93a548a40ca6/tree/Src/jobs.c#l2674
https://sourceforge.net/p/zsh/code/ci/77045ef899e53b9598bebc5a41db93a548a40ca6/tree/Src/signals.c#l538
Install fish on CI to test this.
|
| |
|
|
|
| |
Problem: Terminal buffers are not refreshed when processing keys that
trigger partial mappings.
Solution: Process due terminal refreshes before redrawing.
|
| |
|
|
|
|
|
| |
Problem: Terminal doesn't detect if the PTY process is suspended or
offer a convenient way for the user to resume the process.
Solution: Detect suspended PTY process on SIGCHLD and show virtual text
"[Process suspended]" at the bottom-left. Resume the process
when the user presses a key.
|
| |
|
|
|
|
| |
Problem: heap use-after-free if OptionSet autocommands from setting a terminal's
&buftype wipe the buffer.
Solution: set b_locked during OptionSet for &buftype.
|
| |
|
|
|
|
|
|
| |
Problem:
Recombining composing chars in terminal doesn't work at right edge.
Solution:
Check for the case where printing the previous char didn't advance the
cursor. Reset at_phantom when returning to combine_pos.
|
| |
|
| |
The same reason in #26440 applies to Windows as well.
|
| |
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
| |
Problem: Wrong terminal scrollback if BufFile* autocommand drains PTY
output but doesn't process the pending refresh.
Solution: Refresh scrollback before refreshing screen in terminal_open()
if scrollback has been allocated.
|
| |
|
|
|
|
| |
Problem: Terminal loses output if a BufFilePre or BufFilePost autocmd
polls for events.
Solution: Rename the buffer after allocating the terminal instance. Also
fix buffer getting wrong name if BufFilePre uses NameBuff.
|
| | |
|
| |
|
|
|
| |
Problem: When TermOpen polls for enough events to use the scrollback
buffer, scrollback is lost until the next terminal refresh.
Solution: Allocate the scrollback buffer when it's needed.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: :wqall! doesn't close a terminal buffer like :qall! does
(after 8.0.1525).
Solution: Check eap->forceit (zeertzjq).
Ref: https://github.com/vim/vim/issues/2654#issuecomment-366803932
related: vim/vim#2654
related: neovim/neovim#14061
closes: vim/vim#19129
https://github.com/vim/vim/commit/d8558fdf4f2758163218289637e82c3ae2d617ec
|
| |
|
|
| |
It turns out that uv_write() doesn't queue the write if there are no
pending writes, so vim.uv.run() isn't needed to reproduce the crash.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: :edit and :enew may reuse a 1-line terminal buffer, causing
the new buffer to still be a terminal buffer.
Solution: Don't reuse a terminal buffer, as it's not reused when it has
more than 1 line.
After this change close_buffer() is the only place where buf_freeall()
can be called on a terminal buffer, so move the buf_close_terminal()
call into buf_freeall() to save some code. Furthermore, closing the
terminal in buf_freeall() is probably more correct anyway, as it is
"things allocated for a buffer that are related to the file".
Also, remove the useless check for on_detach callbacks deleting buffer.
Even if b_locked fails to prevent that, the crash will happen at the end
of buf_updates_unload() first. On the other hand, many other call sites
of buf_updates_unload() and other buffer_updates_* functions don't set
b_locked, which may be a problem as well...
|
| |
|
|
|
|
|
|
|
| |
Problem: Calling termopen() or nvim_open_term() on a buffer with an
existing terminal leads to two terminals writing to the same
buffer if the terminal job is still running, or memory leak
if the terminal job has exited.
Solution: Close the terminal if the terminal job has exited, otherwise
report an error. For nvim_open_term() also don't write a
closed terminal's buffer content to the PTY.
|
| |
|
|
|
|
| |
Problem: Crash when a terminal receives OSC 2 just after closing its
buffer but before terminal job exits.
Solution: Remove FUNC_ATTR_NONNULL_ALL from buf_set_term_title() and
check for NULL.
|
| |
|
|
|
|
|
| |
Problem: Destroying a terminal with pending TermRequest leads to
heap-use-after-free when processing TermRequest afterwards.
Solution: Store the buffer handle instead of the Terminal pointer in the
pending TermRequest event, and don't emit TermRequest if the
terminal is already closed.
|
| |
|
|
| |
Problem: Wrong row in TermRequest with full scrollback.
Solution: Subtract by the number of lines deleted from scrollback.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
Problem: window options and terminal focus notifications not updated when
switching terminals without leaving terminal mode.
Solution: update them.
|
| | |
|