diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-05-21 23:59:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-21 23:59:14 +0200 |
commit | cbf0360179fa5a5045005bc2be0b270f97f3bb23 (patch) | |
tree | b160c396d91392929ee4cd4b51aa42ec50e5d1f2 /src | |
parent | 1f1a65a9e4c602cd80458b213c28eadbdb5b1de1 (diff) | |
parent | 646e1c3a3adf89928959c3a0d6a1bd7c55ca932f (diff) | |
download | rneovim-cbf0360179fa5a5045005bc2be0b270f97f3bb23.tar.gz rneovim-cbf0360179fa5a5045005bc2be0b270f97f3bb23.tar.bz2 rneovim-cbf0360179fa5a5045005bc2be0b270f97f3bb23.zip |
Merge pull request #13729 from devbhansingh/ui_enter_prompt
feat(ui): clear message history explicitly with msg_history_clear event
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/ui_events.in.h | 2 | ||||
-rw-r--r-- | src/nvim/message.c | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h index 63aaaae38a..0030f9edf7 100644 --- a/src/nvim/api/ui_events.in.h +++ b/src/nvim/api/ui_events.in.h @@ -174,4 +174,6 @@ void msg_ruler(Array content) FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY; void msg_history_show(Array entries) FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY; +void msg_history_clear(void) + FUNC_API_SINCE(10) FUNC_API_REMOTE_ONLY; #endif // NVIM_API_UI_EVENTS_IN_H diff --git a/src/nvim/message.c b/src/nvim/message.c index 49549bcc26..35a57b708d 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -125,6 +125,8 @@ static size_t msg_ext_cur_len = 0; static bool msg_ext_overwrite = false; ///< will overwrite last message static int msg_ext_visible = 0; ///< number of messages currently visible +static bool msg_ext_history_visible = false; + /// Shouldn't clear message after leaving cmdline static bool msg_ext_keep_after_cmdline = false; @@ -1025,6 +1027,9 @@ void ex_messages(void *const eap_p) // Display what was not skipped. if (ui_has(kUIMessages)) { + if (msg_silent) { + return; + } Array entries = ARRAY_DICT_INIT; for (; p != NULL; p = p->next) { if (p->msg != NULL && p->msg[0] != NUL) { @@ -1040,6 +1045,8 @@ void ex_messages(void *const eap_p) } } ui_call_msg_history_show(entries); + msg_ext_history_visible = true; + wait_return(false); } else { msg_hist_off = true; for (; p != NULL && !got_int; p = p->next) { @@ -3126,6 +3133,10 @@ void msg_ext_clear(bool force) msg_ext_visible = 0; msg_ext_overwrite = false; // nothing to overwrite } + if (msg_ext_history_visible) { + ui_call_msg_history_clear(); + msg_ext_history_visible = false; + } // Only keep once. msg_ext_keep_after_cmdline = false; |