aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-03-14 11:49:46 +0100
committerbfredl <bjorn.linse@gmail.com>2023-03-14 13:37:43 +0100
commitd6ecead36406233cc56353dd05f3380f0497630f (patch)
tree6adad28d9a446e422f114d285107595c563760a8 /src/nvim/message.c
parentef31444cccdd93f515a8b7a968268cb04e680370 (diff)
downloadrneovim-d6ecead36406233cc56353dd05f3380f0497630f.tar.gz
rneovim-d6ecead36406233cc56353dd05f3380f0497630f.tar.bz2
rneovim-d6ecead36406233cc56353dd05f3380f0497630f.zip
refactor(screen): screen.c delenda est
drawscreen.c vs screen.c makes absolutely no sense. The screen exists only to draw upon it, therefore helper functions are distributed randomly between screen.c and the file that does the redrawing. In addition screen.c does a lot of drawing on the screen. It made more sense for vim/vim as our grid.c is their screen.c Not sure if we want to dump all the code for option chars into optionstr.c, so keep these in a optionchar.c for now.
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c27
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;
+ }
+ }
+}