neovim/test/functional/terminal
ibhagwan 1d11808bfd
fix(terminal): interrupt/got_int hangs terminal (#30056)
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>
2024-08-20 06:23:56 +08:00
..
altscreen_spec.lua test: improve test conventions 2024-04-23 18:17:04 +02:00
api_spec.lua test: improve test conventions 2024-04-23 18:17:04 +02:00
buffer_spec.lua fix(terminal): interrupt/got_int hangs terminal (#30056) 2024-08-20 06:23:56 +08:00
channel_spec.lua test: improve test conventions 2024-04-23 18:17:04 +02:00
clipboard_spec.lua feat(terminal): add support for copying with OSC 52 in embedded terminal (#29117) 2024-06-11 13:18:06 -05:00
cursor_spec.lua test: improve test conventions 2024-04-23 18:17:04 +02:00
edit_spec.lua test: improve test conventions 2024-04-23 18:17:04 +02:00
ex_terminal_spec.lua test: improve test conventions 2024-04-23 18:17:04 +02:00
highlight_spec.lua feat(term): support OSC 8 hyperlinks in :terminal (#30050) 2024-08-15 06:09:14 -05:00
mouse_spec.lua refactor(terminal): move :terminal defaults to _defaults.lua 2024-06-12 10:43:57 -05:00
parser_spec.lua fix(terminal): handle C0 characters in OSC terminator (#30090) 2024-08-19 06:43:06 -05:00
scrollback_spec.lua test: improve test conventions 2024-04-23 18:17:04 +02:00
testutil.lua fix(ui): avoid ambiguity about last chunk when flushing halfway (#29718) 2024-07-15 18:35:20 +08:00
tui_spec.lua fix(tui): set id parameter in OSC 8 sequences (#29840) 2024-07-24 09:04:09 -05:00
window_spec.lua feat(term): enable reflow by default (#21124) 2024-08-10 10:26:07 +02:00
window_split_tab_spec.lua refactor(terminal): move :terminal defaults to _defaults.lua 2024-06-12 10:43:57 -05:00