-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
[RFC] Move terminal reedit detection code to do_ecmd() #5445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Can you add a test? |
This is happening because of the |
// this is needed for when we are called by do_argfile() and the new | ||
// argument index becomes the terminal buffer we are already editing | ||
check_arg_idx(curwin); | ||
maketitle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is maketitle() needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title shows the index in the argument list (e.g. (2 of 5)), because we can have switched to a new entry (when this function was called from do_argfile()
), we need to update the title.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally the index in the argument list isn't switched when the buffer is not reloaded or changed.
I was able to reproduce the
error (occurring in the builds) locally. Looking at the backtrace now.
|
What's happing? Are the |
The test failure accidentally exposes a bug in our
|
If the backing stream for a terminal was closed (e.g. if the shell exits unexpectedly) there may be pending input on the loop which will be processed before the terminal close event (which is queued on the same loop). terminal_send checks term->closed but this does not reflect the state of the underlying streams. The terminal.c module in fact has no knowledge of the streams (this seems intentional: it is abstracted as TerminalOption.write_cb). The SIGCHLD handler (pty_process_unix.c) is executed immediately, and it triggers a stream teardown so Stream.closed=false (TerminalJobData.in.closed). When the pending writes are handled by eval.c:term_write, wstream_write() aborts because it sees the closed Stream. References neovim#5445 neovim#5445 (comment)
If the backing stream for a :terminal was closed (e.g. if the shell exits unexpectedly) there may be pending input on the loop which will be processed before the terminal close event (which is queued on the same loop). terminal_send checks term->closed but this does not reflect the state of the underlying streams. The terminal.c module in fact has no knowledge of the streams (this seems intentional: it is abstracted as TerminalOption.write_cb). The SIGCHLD handler (pty_process_unix.c) is executed immediately, and it triggers a stream teardown so Stream.closed=false (TerminalJobData.in.closed). When the pending writes are handled by eval.c:term_write, wstream_write() aborts because it sees the closed Stream. To avoid that, this commit checks Stream.closed in eval:term_write() before writing to the WStream. (As hinted above, we cannot do this in terminal:terminal_send() because that module cannot inspect the underlying streams.) References neovim#5445 neovim#5445 (comment)
If the backing stream for a :terminal was closed (e.g. if the shell exits unexpectedly) there may be pending input on the loop which will be processed before the terminal close event (which is queued on the same loop). terminal_send checks term->closed but this does not reflect the state of the underlying streams. The terminal.c module in fact has no knowledge of the streams (this seems intentional: it is abstracted as TerminalOption.write_cb). The SIGCHLD handler (pty_process_unix.c) is executed immediately, and it triggers a stream teardown so Stream.closed=false (TerminalJobData.in.closed). When the pending writes are handled by eval.c:term_write, wstream_write() aborts because it sees the closed Stream. To avoid that, this commit checks Stream.closed in eval:term_write() before writing to the WStream. (As hinted above, we cannot do this in terminal:terminal_send() because that module cannot inspect the underlying streams.) References neovim#5445 neovim#5445 (comment)
Closes issue #4784