diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-03-14 14:00:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 14:00:56 +0100 |
commit | d1e0f7454b5fc61d26db5af5ce00c1894e7c49fc (patch) | |
tree | ef972775c047745b19db5c06e1e490090d3a26f0 /src/nvim/message.c | |
parent | 4f7879dff0f0dc22ddf4cb2a2095b88605a3bab0 (diff) | |
parent | d6ecead36406233cc56353dd05f3380f0497630f (diff) | |
download | rneovim-d1e0f7454b5fc61d26db5af5ce00c1894e7c49fc.tar.gz rneovim-d1e0f7454b5fc61d26db5af5ce00c1894e7c49fc.tar.bz2 rneovim-d1e0f7454b5fc61d26db5af5ce00c1894e7c49fc.zip |
Merge pull request #22666 from bfredl/unscreen
refactor(screen): screen.c delenda est
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index dc88c53392..aecb46c6bd 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -49,7 +49,6 @@ #include "nvim/pos.h" #include "nvim/regexp.h" #include "nvim/runtime.h" -#include "nvim/screen.h" #include "nvim/strings.h" #include "nvim/ui.h" #include "nvim/ui_compositor.h" @@ -1340,6 +1339,14 @@ void set_keep_msg(char *s, int attr) keep_msg_attr = attr; } +/// Return true if printing messages should currently be done. +bool messaging(void) +{ + // TODO(bfredl): with general support for "async" messages with p_ch, + // this should be re-enabled. + return !(p_lz && char_avail() && !KeyTyped) && (p_ch > 0 || ui_has(kUIMessages)); +} + void msgmore(long n) { long pn; @@ -3807,3 +3814,21 @@ int vim_dialog_yesnoallcancel(int type, char *title, char *message, int dflt) } return VIM_CANCEL; } + +/// Check if there should be a delay to allow the user to see a message. +/// +/// Used before clearing or redrawing the screen or the command line. +void msg_check_for_delay(bool check_msg_scroll) +{ + if ((emsg_on_display || (check_msg_scroll && msg_scroll)) + && !did_wait_return + && emsg_silent == 0 + && !in_assert_fails) { + ui_flush(); + os_delay(1006L, true); + emsg_on_display = false; + if (check_msg_scroll) { + msg_scroll = false; + } + } +} |