From 911f3d962358bb032b55e9984d0b25ffc522ff49 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 21 Sep 2023 10:18:37 +0200 Subject: 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. --- src/nvim/ui_client.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/nvim/ui_client.h') diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index 7e5f847039..05964422f3 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -23,6 +23,9 @@ EXTERN sattr_T *grid_line_buf_attr INIT(= NULL); // ID of the ui client channel. If zero, the client is not running. EXTERN uint64_t ui_client_channel_id INIT(= 0); +// exit status from embedded nvim process +EXTERN int ui_client_exit_status INIT(= 0); + // TODO(bfredl): the current structure for how tui and ui_client.c communicate is a bit awkward. // This will be restructured as part of The UI Devirtualization Project. -- cgit From 5f03a1eaabfc8de2b3a9c666fcd604763f41e152 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 20 Oct 2023 15:10:33 +0200 Subject: build(lint): remove unnecessary clint.py rules Uncrustify is the source of truth where possible. Remove any redundant checks from clint.py. --- src/nvim/ui_client.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/nvim/ui_client.h') diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index 05964422f3..26bb037511 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -16,29 +16,29 @@ typedef struct { } UIClientHandler; // Temporary buffer for converting a single grid_line event -EXTERN size_t grid_line_buf_size INIT(= 0); -EXTERN schar_T *grid_line_buf_char INIT(= NULL); -EXTERN sattr_T *grid_line_buf_attr INIT(= NULL); +EXTERN size_t grid_line_buf_size INIT( = 0); +EXTERN schar_T *grid_line_buf_char INIT( = NULL); +EXTERN sattr_T *grid_line_buf_attr INIT( = NULL); // ID of the ui client channel. If zero, the client is not running. -EXTERN uint64_t ui_client_channel_id INIT(= 0); +EXTERN uint64_t ui_client_channel_id INIT( = 0); // exit status from embedded nvim process -EXTERN int ui_client_exit_status INIT(= 0); +EXTERN int ui_client_exit_status INIT( = 0); // TODO(bfredl): the current structure for how tui and ui_client.c communicate is a bit awkward. // This will be restructured as part of The UI Devirtualization Project. /// Whether ui client has sent nvim_ui_attach yet -EXTERN bool ui_client_attached INIT(= false); +EXTERN bool ui_client_attached INIT( = false); /// Whether ui client has gotten a response about the bg color of the terminal, /// kTrue=dark, kFalse=light, kNone=no response yet -EXTERN TriState ui_client_bg_response INIT(= kNone); +EXTERN TriState ui_client_bg_response INIT( = kNone); /// The ui client should forward its stdin to the nvim process /// by convention, this uses fd=3 (next free number after stdio) -EXTERN bool ui_client_forward_stdin INIT(= false); +EXTERN bool ui_client_forward_stdin INIT( = false); #define UI_CLIENT_STDIN_FD 3 // uncrustify:off -- cgit From 4f8941c1a5f1ef6caa410feeb52e343db22763ce Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 10 Nov 2023 12:23:42 +0100 Subject: refactor: replace manual header guards with #pragma once It is less error-prone than manually defining header guards. Pretty much all compilers support it even if it's not part of the C standard. --- src/nvim/ui_client.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/nvim/ui_client.h') diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index 26bb037511..fbee942cdf 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -1,5 +1,4 @@ -#ifndef NVIM_UI_CLIENT_H -#define NVIM_UI_CLIENT_H +#pragma once #include #include @@ -47,5 +46,3 @@ EXTERN bool ui_client_forward_stdin INIT( = false); # include "ui_events_client.h.generated.h" #endif // uncrustify:on - -#endif // NVIM_UI_CLIENT_H -- cgit From 8d9789a0f3b748b75ac4ae1b8e43d27af40d49fe Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Tue, 7 Nov 2023 11:31:21 -0600 Subject: docs: deprecate the "term_background" UI field --- src/nvim/ui_client.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/nvim/ui_client.h') diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index fbee942cdf..db1ab463f8 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -31,10 +31,6 @@ EXTERN int ui_client_exit_status INIT( = 0); /// Whether ui client has sent nvim_ui_attach yet EXTERN bool ui_client_attached INIT( = false); -/// Whether ui client has gotten a response about the bg color of the terminal, -/// kTrue=dark, kFalse=light, kNone=no response yet -EXTERN TriState ui_client_bg_response INIT( = kNone); - /// The ui client should forward its stdin to the nvim process /// by convention, this uses fd=3 (next free number after stdio) EXTERN bool ui_client_forward_stdin INIT( = false); -- cgit From e38a05369293293b5b510b1b0014fcc2e7cb87f4 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 18:46:03 +0100 Subject: build(IWYU): export generated headers --- src/nvim/ui_client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ui_client.h') diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index db1ab463f8..4fcccf04b2 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -39,6 +39,6 @@ EXTERN bool ui_client_forward_stdin INIT( = false); // uncrustify:off #ifdef INCLUDE_GENERATED_DECLARATIONS # include "ui_client.h.generated.h" -# include "ui_events_client.h.generated.h" +# include "ui_events_client.h.generated.h" // IWYU pragma: export #endif // uncrustify:on -- cgit From 6c14ae6bfaf51415b555e9a6b85d1d280976358d Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 27 Nov 2023 20:27:32 +0100 Subject: refactor: rename types.h to types_defs.h --- src/nvim/ui_client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ui_client.h') diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index 4fcccf04b2..383f69c5f7 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -7,7 +7,7 @@ #include "nvim/api/private/defs.h" #include "nvim/grid_defs.h" #include "nvim/macros.h" -#include "nvim/types.h" +#include "nvim/types_defs.h" typedef struct { const char *name; -- cgit From c9f53d0e40815644bbf7c57a0792f2c793c954aa Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Nov 2023 19:00:14 +0800 Subject: refactor: iwyu (#26269) --- src/nvim/ui_client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ui_client.h') diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index 383f69c5f7..48dd9a0835 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -5,7 +5,7 @@ #include #include "nvim/api/private/defs.h" -#include "nvim/grid_defs.h" +#include "nvim/grid_defs.h" // IWYU pragma: keep #include "nvim/macros.h" #include "nvim/types_defs.h" -- cgit From 79b6ff28ad1204fbb4199b9092f5c578d88cb28e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 Nov 2023 20:31:00 +0100 Subject: refactor: fix headers with IWYU --- src/nvim/ui_client.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ui_client.h') diff --git a/src/nvim/ui_client.h b/src/nvim/ui_client.h index 48dd9a0835..93170ed86d 100644 --- a/src/nvim/ui_client.h +++ b/src/nvim/ui_client.h @@ -6,7 +6,7 @@ #include "nvim/api/private/defs.h" #include "nvim/grid_defs.h" // IWYU pragma: keep -#include "nvim/macros.h" +#include "nvim/macros_defs.h" #include "nvim/types_defs.h" typedef struct { -- cgit