diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-09-21 10:18:37 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-09-21 10:18:37 +0200 |
commit | 911f3d962358bb032b55e9984d0b25ffc522ff49 (patch) | |
tree | a21802a601c1aa4953030d5e24a2ed04b95ab37b /src/nvim/ex_docmd.c | |
parent | f246cf029fb4e7a07788adfa19f91608db7bd816 (diff) | |
download | rneovim-911f3d962358bb032b55e9984d0b25ffc522ff49.tar.gz rneovim-911f3d962358bb032b55e9984d0b25ffc522ff49.tar.bz2 rneovim-911f3d962358bb032b55e9984d0b25ffc522ff49.zip |
fix(tui): don't overwrite an assertion faliure message on exit
If nvim exited with nonzero status this is for one of the two reasons
- `:cquit` was invoked. This is used by users and plugins to communicate
a result, like a nonzero status will fail a `git commit` operation
- There was an internal error or deadly signal. in this case an error
message was likely written to stderr or to the screen.
In the latter case, the error message was often hidden by the TUI
exiting altscreen mode, which erases all visible terminal text.
This change prevents this in the latter case, while still cleaning up
the terminal properly when `:cquit` was deliberatily invoked.
Other cleanup like exiting mouse mode and raw mode is still done.
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 44610c81d8..0a0f7c244d 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -4591,7 +4591,9 @@ static void ex_cquit(exarg_T *eap) FUNC_ATTR_NORETURN { // this does not always pass on the exit code to the Manx compiler. why? - getout(eap->addr_count > 0 ? (int)eap->line2 : EXIT_FAILURE); + int status = eap->addr_count > 0 ? (int)eap->line2 : EXIT_FAILURE; + ui_call_error_exit(status); + getout(status); } /// Do preparations for "qall" and "wqall". |