mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor(misc1): move msgmore function to messages.c
This commit is contained in:
parent
608f74a0de
commit
6dbd4f3787
@ -202,7 +202,6 @@ EXTERN bool msg_did_scroll INIT(= false);
|
||||
|
||||
EXTERN char_u *keep_msg INIT(= NULL); // msg to be shown after redraw
|
||||
EXTERN int keep_msg_attr INIT(= 0); // highlight attr for keep_msg
|
||||
EXTERN bool keep_msg_more INIT(= false); // keep_msg was set by msgmore()
|
||||
EXTERN bool need_fileinfo INIT(= false); // do fileinfo() after redraw
|
||||
EXTERN int msg_scroll INIT(= false); // msg_start() will scroll
|
||||
EXTERN bool msg_didout INIT(= false); // msg_outstr() was used in line
|
||||
|
@ -76,6 +76,8 @@ static int msg_hist_len = 0;
|
||||
static FILE *verbose_fd = NULL;
|
||||
static int verbose_did_open = FALSE;
|
||||
|
||||
bool keep_msg_more = false; // keep_msg was set by msgmore()
|
||||
|
||||
/*
|
||||
* When writing messages to the screen, there are many different situations.
|
||||
* A number of variables is used to remember the current state:
|
||||
@ -1298,6 +1300,49 @@ void set_keep_msg(char *s, int attr)
|
||||
keep_msg_attr = attr;
|
||||
}
|
||||
|
||||
void msgmore(long n)
|
||||
{
|
||||
long pn;
|
||||
|
||||
if (global_busy // no messages now, wait until global is finished
|
||||
|| !messaging()) { // 'lazyredraw' set, don't do messages now
|
||||
return;
|
||||
}
|
||||
|
||||
// We don't want to overwrite another important message, but do overwrite
|
||||
// a previous "more lines" or "fewer lines" message, so that "5dd" and
|
||||
// then "put" reports the last action.
|
||||
if (keep_msg != NULL && !keep_msg_more) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (n > 0) {
|
||||
pn = n;
|
||||
} else {
|
||||
pn = -n;
|
||||
}
|
||||
|
||||
if (pn > p_report) {
|
||||
if (n > 0) {
|
||||
vim_snprintf(msg_buf, MSG_BUF_LEN,
|
||||
NGETTEXT("%ld more line", "%ld more lines", pn),
|
||||
pn);
|
||||
} else {
|
||||
vim_snprintf(msg_buf, MSG_BUF_LEN,
|
||||
NGETTEXT("%ld line less", "%ld fewer lines", pn),
|
||||
pn);
|
||||
}
|
||||
if (got_int) {
|
||||
xstrlcat(msg_buf, _(" (Interrupted)"), MSG_BUF_LEN);
|
||||
}
|
||||
if (msg(msg_buf)) {
|
||||
set_keep_msg(msg_buf, 0);
|
||||
keep_msg_more = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void msg_ext_set_kind(const char *msg_kind)
|
||||
{
|
||||
// Don't change the label of an existing batch:
|
||||
|
@ -325,48 +325,6 @@ int prompt_for_number(int *mouse_used)
|
||||
return i;
|
||||
}
|
||||
|
||||
void msgmore(long n)
|
||||
{
|
||||
long pn;
|
||||
|
||||
if (global_busy // no messages now, wait until global is finished
|
||||
|| !messaging()) { // 'lazyredraw' set, don't do messages now
|
||||
return;
|
||||
}
|
||||
|
||||
// We don't want to overwrite another important message, but do overwrite
|
||||
// a previous "more lines" or "fewer lines" message, so that "5dd" and
|
||||
// then "put" reports the last action.
|
||||
if (keep_msg != NULL && !keep_msg_more) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (n > 0) {
|
||||
pn = n;
|
||||
} else {
|
||||
pn = -n;
|
||||
}
|
||||
|
||||
if (pn > p_report) {
|
||||
if (n > 0) {
|
||||
vim_snprintf(msg_buf, MSG_BUF_LEN,
|
||||
NGETTEXT("%ld more line", "%ld more lines", pn),
|
||||
pn);
|
||||
} else {
|
||||
vim_snprintf(msg_buf, MSG_BUF_LEN,
|
||||
NGETTEXT("%ld line less", "%ld fewer lines", pn),
|
||||
pn);
|
||||
}
|
||||
if (got_int) {
|
||||
xstrlcat(msg_buf, _(" (Interrupted)"), MSG_BUF_LEN);
|
||||
}
|
||||
if (msg(msg_buf)) {
|
||||
set_keep_msg(msg_buf, 0);
|
||||
keep_msg_more = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* flush map and typeahead buffers and give a warning for an error
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user