Commit Graph

35 Commits

Author SHA1 Message Date
zeertzjq
c83fedf0bd fix(terminal): return early if there are no invalid rows
Prevent on_lines emitting out-of-bounds line indexes.
2021-12-08 08:41:46 +08:00
zeertzjq
f4359b5dbd
vim-patch:8.2.3461: distinguish Normal and Terminal-Normal mode #15878
Problem:    Cannot distinguish Normal and Terminal-Normal mode.
Solution:   Make mode() return "nt" for Terminal-Normal mode. (issue vim/vim#8856)
72406a4bd2
2021-10-09 18:15:46 -07:00
Yorick Peterse
c61a3865ee
fix: set cursorlineopt=number in terminal mode (#15493)
When entering terminal mode, cursorlineopt is no longer entirely
disabled. Instead, it's set to `number`. Doing so ensures that users
using `set cursorline` combined with `set cursorlineopt=number` have
consistent highlighting of the line numbers, instead of this being
disabled when entering terminal mode.

Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2021-10-06 16:31:14 -06:00
Justin M. Keyes
6751d6254b
refactor(tests): use assert_alive() #15546 2021-09-01 09:42:53 -07:00
Gregory Anders
3c081d0280 fix(jobwait): always drain process event queues #15402
Problem:
jobwait() returns early if the job was stopped, but the job might have
pending callbacks on its event queue which are required to complete its
teardown. State such as term->closed might not be updated yet (by the
pending callbacks), so codepaths such as :bdelete think the job is still
running.

Solution:
Always flush the job's event queue before returning from jobwait().

ref #15349
2021-08-31 06:53:06 -07:00
Gregory Anders
55defa1a41 fix(terminal): close without ! if the job is stopped
- If the terminal job is still running then ! is still required.

Closes #4683
2021-08-31 06:46:56 -07:00
Dylan Armstrong
6646280d1a
chore: revert unrelated changes in test 2021-02-27 10:02:56 -06:00
Dylan Armstrong
1d4a7c6039
test: use assert_alive helper rather than eq 2021-02-27 09:38:38 -06:00
Dylan Armstrong
a9eeeec5d5 test: segfault test for empty buffer paste on term 2021-02-26 19:55:32 -06:00
Jan Edmund Lazo
56f5e3bd6b
vim-patch:8.0.1525: using :wqa exits even if a job runs in a terminal window
Problem:    Using :wqa exits even if a job runs in a terminal window. (Jason
            Felice)
Solution:   Check if a terminal has a running job. (closes vim/vim#2654)
7a76092a51
2020-12-01 08:52:33 -05:00
Björn Linse
07cc231142 A Mudholland Dr. Recast
The commit summary maybe does not make sense, but calling a function
that does not wait on anything `wait()` makes even less sense.
2020-10-19 21:48:06 +02:00
erw7
b6b270b28f terminal: fix terminal attribute overflow
fixes #11548
2020-07-29 02:16:50 +09:00
Justin M. Keyes
7b764bb43d terminal: disable 'scrolloff' (fixes flicker)
Besides the special-case in get_scrolloff_value(), it makes sense for
'scrolloff' and 'sidescrolloff' to reflect the correct values (for
plugins, scripts, …).

ref 53d607af9c53accfd634435908fb79061f1212b9
ref #11915
ref #12230
2020-05-04 21:21:33 -07:00
Justin M. Keyes
c34130d13a API: deprecate nvim_command_output 2019-12-02 20:52:06 -08:00
erw7
1bb7ea189e win_line: Fix crash with 'rightleft' in :terminal #11460
fixes #11438

Backtrace:

    0  schar_from_ascii ( p=0x801cc9e112c3 <error: Cannot access memory at address 0x801cc9e112c3>, c=32 ' ') at ../src/nvim/screen.c:5263
    1  0x00007f31460eccc5 in win_line (wp=wp@entry=0x7fffc9df6230, lnum=lnum@entry=11, startrow=startrow@entry=10, endrow=41, nochange=false, number_only=number_only@entry=false) at ../src/nvim/screen.c:4025
    2  0x00007f31460eed8e in win_update (wp=wp@entry=0x7fffc9df6230) at ../src/nvim/screen.c:1403
    3  0x00007f31460f011f in update_screen (type=<optimized out>) at ../src/nvim/screen.c:502
    4  0x00007f3146138ef4 in normal_redraw (s=s@entry=0x7fffd0a5f700) at ../src/nvim/normal.c:1247
    5  0x00007f314613b159 in normal_check (state=0x7fffd0a5f700) at ../src/nvim/normal.c:1324
    6  0x00007f31460accfe in state_enter (s=0x7fffd0a5f700) at ../src/nvim/state.c:28
    7  0x00007f3146143099 in normal_enter (cmdwin=<optimized out>, noexmode=<optimized out>) at ../src/nvim/normal.c:463
    8  0x00007f314618b541 in main (argc=<optimized out>, argv=<optimized out>) at ../src/nvim/main.c:580
2019-11-28 20:09:03 -08:00
Björn Linse
a330129a28 tests/ui: cleanup illegitimate usages of "attr_ignore"
"attr_ignore" is an anti-pattern, with snapshot_util()
just include all the highlights already.
2019-10-13 22:10:42 +02:00
Jan Edmund Lazo
47d679c0c2
tests: win: enable buffer focus test 2019-08-18 21:40:27 -04:00
Andrew Pyatkov
894f6bee54 :terminal : set topline based on window height #8325
closes #8324
closes #8556
2019-01-29 03:00:48 +01:00
Björn Linse
3d88287e30 tests: introduce screen:expect{...} form 2018-08-27 15:15:49 +02:00
Marco Hinz
01570f1ff3
terminal: handle &confirm and :confirm on unloading (#8726)
Show a proper confirmation dialog when trying to unload a terminal buffer while
the confirm option is set or when :confirm is used.

Fixes https://github.com/neovim/neovim/issues/4651
2018-07-12 14:57:20 +02:00
Justin M. Keyes
d2d76882f7 win/test: enable more :terminal tests
To deal with SIGWINCH limitations on Windows, change some resize tests
to _shrink_ the screen width. ... But this didn't work, so still
ignoring those tests on Windows.
2017-08-16 09:13:44 +02:00
erw7
4b1f21de75 win: support :terminal 2017-08-16 09:13:43 +02:00
ZyX
65fb622000 functests: Replace execute with either command or feed_command
Hope this will make people using feed_command less likely: this hides bugs.
Already found at least two:

1. msgpackparse() will show internal error: hash_add() in case of duplicate
   keys, though it will still work correctly. Currently silenced.
2. ttimeoutlen was spelled incorrectly, resulting in option not being set when
   expected. Test was still functioning somehow though. Currently fixed.
2017-04-09 03:24:08 +03:00
Justin M. Keyes
d1d35c9cfc test: backtick expansion #6218 2017-03-06 12:40:22 +01:00
oni-link
3030ef825d terminal.c: Reset cursor postion when using termopen() (#6212)
After using 'termopen("echo") the current buffer content is changed,
but the cursor position of the current window is not updated.
Because of this, a call to 'mb_adjust_cursor()'  can lead to a
heap-buffer-overflow.

Fix this by resetting the cursor for the current window.

Fixes #3161
2017-03-04 20:12:57 +01:00
Justin M. Keyes
937e54f865 terminal: Keep cursor position.
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.
2017-03-01 14:47:49 +01:00
Michael Ennen
5e4eb18eb0 Add some tests and cleanup. 2016-12-12 10:17:35 -05:00
Rui Abreu Ferreira
39c628d031 Mark some functional tests as pending in Windows 2016-08-26 08:21:41 +01:00
Björn Linse
f332eba16c tests: don't ignore highlights in terminal tests 2016-08-14 21:53:02 +02:00
ZyX
ff470bb853 functests: Check logs in lua code
It is otherwise impossible to determine which test failed sanitizer/valgrind
check. test/functional/helpers.lua module return was changed so that tests which
do not provide after_each function to get new check will automatically fail.
2016-06-10 21:50:49 +03:00
Justin M. Keyes
8dd91ddb73 test: term_close use-after-free
References #4393
2016-05-15 19:47:24 -04:00
Marco Hinz
4a69e55f39 test/functional: clean up according to luacheck (part 1) 2015-11-23 13:57:21 +01:00
Scott Prager
b8ae09b3cf term: after <C-\>, resume normal input loop
Pressing <C-\> and then a mouse click will insert the click into the
terminal as if a keyboard button had been pressed.

Keep track of whether the last input was <C-\> and only call
terminal_send_key() if the next input is a key press.
2015-04-05 13:40:21 -04:00
Scott Prager
b6296f4e84 terminal: Handle loss of focus in event loop.
While in a terminal and insert mode, if an event caused loss of focus,
nvim would stay in the terminal event loop causing an inconsistent view
of internal state and/or segfault.

Remove the "term" argument from terminal_enter() as it only makes sense
to call it with curbuf->terminal. Terminate the loop when switched to a
different buffer.

fixes #2301
2015-04-05 13:39:55 -04:00
Thiago de Arruda
2aa2513b8e test: Add terminal tests
- Modify tty-test to allow easier control over the terminal
- Add a new directory with various terminal tests/specifications
- Remove a pending job/pty test.
- Flush stdout in Screen:snapshot_util() (avoid waiting for the test to finish)
- Replace libuv sigwinch watcher by a sigaction handler. libuv randomly fails to
  deliver signals on OSX. Might be related to the problem fixed by
  @bbcddc55ee1e5605657592644be0102ed3a5f104 (under the hoods, libuv uses a pipe
  to deliver signals to the main thread, which might be blocking in some
  situations)
2015-03-25 18:57:36 -03:00