mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 9.1.0908: not possible to configure :messages
Problem: not possible to configure :messages Solution: add the 'messagesopt' option (Shougo Matsushita) closes: #16068 Co-authored-by: h_east <h.east.727@gmail.com> Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*message.txt* For Vim version 9.1. Last change: 2024 Nov 14
|
*message.txt* For Vim version 9.1. Last change: 2024 Dec 06
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -29,7 +29,7 @@ depends on the 'shortmess' option.
|
|||||||
Clear messages, keeping only the {count} most
|
Clear messages, keeping only the {count} most
|
||||||
recent ones.
|
recent ones.
|
||||||
|
|
||||||
The number of remembered messages is determined by the 'msghistory' option.
|
The number of remembered messages is determined by the 'messagesopt' option.
|
||||||
|
|
||||||
*g<*
|
*g<*
|
||||||
The "g<" command can be used to see the last page of previous command output.
|
The "g<" command can be used to see the last page of previous command output.
|
||||||
@@ -837,6 +837,7 @@ If you accidentally hit <Enter> or <Space> and you want to see the displayed
|
|||||||
text then use |g<|. This only works when 'more' is set.
|
text then use |g<|. This only works when 'more' is set.
|
||||||
|
|
||||||
To reduce the number of hit-enter prompts:
|
To reduce the number of hit-enter prompts:
|
||||||
|
- Set 'messagesopt'.
|
||||||
- Set 'cmdheight' to 2 or higher.
|
- Set 'cmdheight' to 2 or higher.
|
||||||
- Add flags to 'shortmess'.
|
- Add flags to 'shortmess'.
|
||||||
- Reset 'showcmd' and/or 'ruler'.
|
- Reset 'showcmd' and/or 'ruler'.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
*options.txt* For Vim version 9.1. Last change: 2024 Dec 03
|
*options.txt* For Vim version 9.1. Last change: 2024 Dec 06
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -4439,7 +4439,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
global
|
global
|
||||||
A history of ":" commands, and a history of previous search patterns
|
A history of ":" commands, and a history of previous search patterns
|
||||||
is remembered. This option decides how many entries may be stored in
|
is remembered. This option decides how many entries may be stored in
|
||||||
each of these histories (see |cmdline-editing| and 'msghistory' for
|
each of these histories (see |cmdline-editing| and 'messagesopt' for
|
||||||
the number of messages to remember).
|
the number of messages to remember).
|
||||||
The maximum value is 10000.
|
The maximum value is 10000.
|
||||||
NOTE: This option is set to the Vi default value when 'compatible' is
|
NOTE: This option is set to the Vi default value when 'compatible' is
|
||||||
@@ -5634,6 +5634,26 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
generated from a list of items, e.g., the Buffers menu. Changing this
|
generated from a list of items, e.g., the Buffers menu. Changing this
|
||||||
option has no direct effect, the menu must be refreshed first.
|
option has no direct effect, the menu must be refreshed first.
|
||||||
|
|
||||||
|
*'messagesopt'* *'mopt'*
|
||||||
|
'messagesopt' 'mopt' string (default "hit-enter,history:500")
|
||||||
|
global
|
||||||
|
|
||||||
|
Option settings when outputting messages. It can consist of the
|
||||||
|
following items. Items must be separated by a comma.
|
||||||
|
|
||||||
|
hit-enter Use |hit-enter| prompt when the message is longer than
|
||||||
|
'cmdheight' size.
|
||||||
|
|
||||||
|
wait:{n} Ignored when "hit-enter" is present. Instead of using
|
||||||
|
|hit-enter| prompt, will simply wait for {n}
|
||||||
|
milliseconds so the user has a chance to read the
|
||||||
|
message, use 0 to disable sleep (but then the user may
|
||||||
|
miss an important message).
|
||||||
|
|
||||||
|
history:{n} Determines how many entries are remembered in the
|
||||||
|
|:messages| history. The maximum value is 10000.
|
||||||
|
Setting it to zero clears the message history.
|
||||||
|
|
||||||
*'mkspellmem'* *'msm'*
|
*'mkspellmem'* *'msm'*
|
||||||
'mkspellmem' 'msm' string (default "460000,2000,500")
|
'mkspellmem' 'msm' string (default "460000,2000,500")
|
||||||
global
|
global
|
||||||
@@ -5917,13 +5937,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
time in msec between two mouse clicks for the second click to be
|
time in msec between two mouse clicks for the second click to be
|
||||||
recognized as a multi click.
|
recognized as a multi click.
|
||||||
|
|
||||||
*'msghistory'* *'mhi'*
|
|
||||||
'msghistory' 'mhi' number (default 500)
|
|
||||||
global
|
|
||||||
Determines how many entries are remembered in the |:messages| history.
|
|
||||||
The maximum value is 10000.
|
|
||||||
Setting it to zero clears the message history.
|
|
||||||
|
|
||||||
|
|
||||||
*'mzquantum'* *'mzq'*
|
*'mzquantum'* *'mzq'*
|
||||||
'mzquantum' 'mzq' number (default 100)
|
'mzquantum' 'mzq' number (default 100)
|
||||||
|
@@ -499,9 +499,9 @@ $quote eval.txt /*$quote*
|
|||||||
'menc' options.txt /*'menc'*
|
'menc' options.txt /*'menc'*
|
||||||
'menuitems' options.txt /*'menuitems'*
|
'menuitems' options.txt /*'menuitems'*
|
||||||
'mesg' vi_diff.txt /*'mesg'*
|
'mesg' vi_diff.txt /*'mesg'*
|
||||||
|
'messagesopt' options.txt /*'messagesopt'*
|
||||||
'mfd' options.txt /*'mfd'*
|
'mfd' options.txt /*'mfd'*
|
||||||
'mh' options.txt /*'mh'*
|
'mh' options.txt /*'mh'*
|
||||||
'mhi' options.txt /*'mhi'*
|
|
||||||
'mis' options.txt /*'mis'*
|
'mis' options.txt /*'mis'*
|
||||||
'mkspellmem' options.txt /*'mkspellmem'*
|
'mkspellmem' options.txt /*'mkspellmem'*
|
||||||
'ml' options.txt /*'ml'*
|
'ml' options.txt /*'ml'*
|
||||||
@@ -517,6 +517,7 @@ $quote eval.txt /*$quote*
|
|||||||
'modelines' options.txt /*'modelines'*
|
'modelines' options.txt /*'modelines'*
|
||||||
'modifiable' options.txt /*'modifiable'*
|
'modifiable' options.txt /*'modifiable'*
|
||||||
'modified' options.txt /*'modified'*
|
'modified' options.txt /*'modified'*
|
||||||
|
'mopt' options.txt /*'mopt'*
|
||||||
'more' options.txt /*'more'*
|
'more' options.txt /*'more'*
|
||||||
'mouse' options.txt /*'mouse'*
|
'mouse' options.txt /*'mouse'*
|
||||||
'mousef' options.txt /*'mousef'*
|
'mousef' options.txt /*'mousef'*
|
||||||
@@ -532,7 +533,6 @@ $quote eval.txt /*$quote*
|
|||||||
'mousetime' options.txt /*'mousetime'*
|
'mousetime' options.txt /*'mousetime'*
|
||||||
'mp' options.txt /*'mp'*
|
'mp' options.txt /*'mp'*
|
||||||
'mps' options.txt /*'mps'*
|
'mps' options.txt /*'mps'*
|
||||||
'msghistory' options.txt /*'msghistory'*
|
|
||||||
'msm' options.txt /*'msm'*
|
'msm' options.txt /*'msm'*
|
||||||
'mzq' options.txt /*'mzq'*
|
'mzq' options.txt /*'mzq'*
|
||||||
'mzquantum' options.txt /*'mzquantum'*
|
'mzquantum' options.txt /*'mzquantum'*
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
*version9.txt* For Vim version 9.1. Last change: 2024 Dec 05
|
*version9.txt* For Vim version 9.1. Last change: 2024 Dec 06
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -41667,7 +41667,7 @@ Options: ~
|
|||||||
popup
|
popup
|
||||||
'findfunc' Vim function to obtain the results for a |:find|
|
'findfunc' Vim function to obtain the results for a |:find|
|
||||||
command
|
command
|
||||||
'msghistory' Max number of messages to remember
|
'messagesopt' configure |:messages| and |hit-enter| prompt
|
||||||
'winfixbuf' Keep buffer focused in a window
|
'winfixbuf' Keep buffer focused in a window
|
||||||
'tabclose' Which tab page to focus after closing a tab page
|
'tabclose' Which tab page to focus after closing a tab page
|
||||||
't_xo' Terminal uses XON/XOFF handshaking (e.g. vt420)
|
't_xo' Terminal uses XON/XOFF handshaking (e.g. vt420)
|
||||||
|
@@ -749,8 +749,8 @@ call <SID>AddOption("terse", gettext("add 's' flag in 'shortmess' (don't show se
|
|||||||
call <SID>BinOptionG("terse", &terse)
|
call <SID>BinOptionG("terse", &terse)
|
||||||
call <SID>AddOption("shortmess", gettext("list of flags to make messages shorter"))
|
call <SID>AddOption("shortmess", gettext("list of flags to make messages shorter"))
|
||||||
call <SID>OptionG("shm", &shm)
|
call <SID>OptionG("shm", &shm)
|
||||||
call <SID>AddOption("msghistory", gettext("how many messages are remembered"))
|
call <SID>AddOption("messagesopt", gettext("Option settings when outputting messages"))
|
||||||
call append("$", " \tset mhi=" . &mhi)
|
call <SID>OptionG("mopt", &mopt)
|
||||||
call <SID>AddOption("showcmd", gettext("show (partial) command keys in location given by 'showcmdloc'"))
|
call <SID>AddOption("showcmd", gettext("show (partial) command keys in location given by 'showcmdloc'"))
|
||||||
let &sc = s:old_sc
|
let &sc = s:old_sc
|
||||||
call <SID>BinOptionG("sc", &sc)
|
call <SID>BinOptionG("sc", &sc)
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
|
|
||||||
static void add_msg_hist(char_u *s, int len, int attr);
|
static void add_msg_hist(char_u *s, int len, int attr);
|
||||||
|
static void check_msg_hist(void);
|
||||||
static void hit_return_msg(void);
|
static void hit_return_msg(void);
|
||||||
static void msg_home_replace_attr(char_u *fname, int attr);
|
static void msg_home_replace_attr(char_u *fname, int attr);
|
||||||
static void msg_puts_attr_len(char *str, int maxlen, int attr);
|
static void msg_puts_attr_len(char *str, int maxlen, int attr);
|
||||||
@@ -51,6 +52,21 @@ struct msg_hist
|
|||||||
static struct msg_hist *first_msg_hist = NULL;
|
static struct msg_hist *first_msg_hist = NULL;
|
||||||
static struct msg_hist *last_msg_hist = NULL;
|
static struct msg_hist *last_msg_hist = NULL;
|
||||||
static int msg_hist_len = 0;
|
static int msg_hist_len = 0;
|
||||||
|
static int msg_hist_max = 500; // The default max value is 500
|
||||||
|
|
||||||
|
// flags obtained from the 'messagesopt' option
|
||||||
|
#define MESSAGES_HIT_ENTER 0x001
|
||||||
|
#define MESSAGES_WAIT 0x002
|
||||||
|
#define MESSAGES_HISTORY 0x004
|
||||||
|
|
||||||
|
// args in 'messagesopt' option
|
||||||
|
#define MESSAGES_OPT_HIT_ENTER "hit-enter"
|
||||||
|
#define MESSAGES_OPT_WAIT "wait:"
|
||||||
|
#define MESSAGES_OPT_HISTORY "history:"
|
||||||
|
|
||||||
|
// The default is "hit-enter,history:500"
|
||||||
|
static int msg_flags = MESSAGES_HIT_ENTER | MESSAGES_HISTORY;
|
||||||
|
static int msg_wait = 0;
|
||||||
|
|
||||||
static FILE *verbose_fd = NULL;
|
static FILE *verbose_fd = NULL;
|
||||||
static int verbose_did_open = FALSE;
|
static int verbose_did_open = FALSE;
|
||||||
@@ -1060,14 +1076,76 @@ delete_first_msg(void)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
check_msg_hist(void)
|
check_msg_hist(void)
|
||||||
{
|
{
|
||||||
// Don't let the message history get too big
|
// Don't let the message history get too big
|
||||||
while (msg_hist_len > 0 && msg_hist_len > p_mhi)
|
while (msg_hist_len > 0 && msg_hist_len > msg_hist_max)
|
||||||
(void)delete_first_msg();
|
(void)delete_first_msg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
messagesopt_changed(void)
|
||||||
|
{
|
||||||
|
char_u *p;
|
||||||
|
int messages_flags_new = 0;
|
||||||
|
int messages_wait_new = 0;
|
||||||
|
int messages_history_new = 0;
|
||||||
|
|
||||||
|
p = p_meo;
|
||||||
|
while (*p != NUL)
|
||||||
|
{
|
||||||
|
if (STRNCMP(p, MESSAGES_OPT_HIT_ENTER,
|
||||||
|
STRLEN_LITERAL(MESSAGES_OPT_HIT_ENTER)) == 0)
|
||||||
|
{
|
||||||
|
p += STRLEN_LITERAL(MESSAGES_OPT_HIT_ENTER);
|
||||||
|
messages_flags_new |= MESSAGES_HIT_ENTER;
|
||||||
|
}
|
||||||
|
else if (STRNCMP(p, MESSAGES_OPT_WAIT,
|
||||||
|
STRLEN_LITERAL(MESSAGES_OPT_WAIT)) == 0
|
||||||
|
&& VIM_ISDIGIT(p[STRLEN_LITERAL(MESSAGES_OPT_WAIT)]))
|
||||||
|
{
|
||||||
|
p += STRLEN_LITERAL(MESSAGES_OPT_WAIT);
|
||||||
|
messages_wait_new = getdigits(&p);
|
||||||
|
messages_flags_new |= MESSAGES_WAIT;
|
||||||
|
}
|
||||||
|
else if (STRNCMP(p, MESSAGES_OPT_HISTORY,
|
||||||
|
STRLEN_LITERAL(MESSAGES_OPT_HISTORY)) == 0
|
||||||
|
&& VIM_ISDIGIT(p[STRLEN_LITERAL(MESSAGES_OPT_HISTORY)]))
|
||||||
|
{
|
||||||
|
p += STRLEN_LITERAL(MESSAGES_OPT_HISTORY);
|
||||||
|
messages_history_new = getdigits(&p);
|
||||||
|
messages_flags_new |= MESSAGES_HISTORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*p != ',' && *p != NUL)
|
||||||
|
return FAIL;
|
||||||
|
if (*p == ',')
|
||||||
|
++p;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Either "wait" or "hit-enter" is required
|
||||||
|
if (!(messages_flags_new & (MESSAGES_HIT_ENTER | MESSAGES_WAIT)))
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
// "history" must be set
|
||||||
|
if (!(messages_flags_new & MESSAGES_HISTORY))
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
// "history" must be <= 10000
|
||||||
|
if (messages_history_new > 10000)
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
msg_flags = messages_flags_new;
|
||||||
|
msg_wait = messages_wait_new;
|
||||||
|
|
||||||
|
msg_hist_max = messages_history_new;
|
||||||
|
check_msg_hist();
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ":messages" command.
|
* ":messages" command.
|
||||||
*/
|
*/
|
||||||
@@ -1228,6 +1306,8 @@ wait_return(int redraw)
|
|||||||
if (need_check_timestamps)
|
if (need_check_timestamps)
|
||||||
check_timestamps(FALSE);
|
check_timestamps(FALSE);
|
||||||
|
|
||||||
|
if (msg_flags & MESSAGES_HIT_ENTER)
|
||||||
|
{
|
||||||
hit_return_msg();
|
hit_return_msg();
|
||||||
|
|
||||||
do
|
do
|
||||||
@@ -1342,6 +1422,13 @@ wait_return(int redraw)
|
|||||||
// typeahead
|
// typeahead
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
c = CAR;
|
||||||
|
// Wait to allow the user to verify the output.
|
||||||
|
do_sleep(msg_wait, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
redir_off = FALSE;
|
redir_off = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
25
src/option.c
25
src/option.c
@@ -3864,31 +3864,6 @@ did_set_number_relativenumber(optset_T *args UNUSED)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Process the updated 'msghistory' option value.
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
did_set_msghistory(optset_T *args UNUSED)
|
|
||||||
{
|
|
||||||
char *errmsg = NULL;
|
|
||||||
|
|
||||||
// 'msghistory' must be positive
|
|
||||||
if (p_mhi < 0)
|
|
||||||
{
|
|
||||||
errmsg = e_argument_must_be_positive;
|
|
||||||
p_mhi = 0;
|
|
||||||
}
|
|
||||||
else if (p_mhi > 10000)
|
|
||||||
{
|
|
||||||
errmsg = e_invalid_argument;
|
|
||||||
p_mhi = 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
check_msg_hist();
|
|
||||||
|
|
||||||
return errmsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(FEAT_LINEBREAK) || defined(PROTO)
|
#if defined(FEAT_LINEBREAK) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Process the new 'numberwidth' option value.
|
* Process the new 'numberwidth' option value.
|
||||||
|
@@ -775,6 +775,7 @@ EXTERN long p_mmt; // 'maxmemtot'
|
|||||||
#ifdef FEAT_MENU
|
#ifdef FEAT_MENU
|
||||||
EXTERN long p_mis; // 'menuitems'
|
EXTERN long p_mis; // 'menuitems'
|
||||||
#endif
|
#endif
|
||||||
|
EXTERN char_u *p_meo; // 'messagesopt'
|
||||||
#ifdef FEAT_SPELL
|
#ifdef FEAT_SPELL
|
||||||
EXTERN char_u *p_msm; // 'mkspellmem'
|
EXTERN char_u *p_msm; // 'mkspellmem'
|
||||||
#endif
|
#endif
|
||||||
@@ -794,7 +795,6 @@ EXTERN int p_mousemev; // 'mousemoveevent'
|
|||||||
#endif
|
#endif
|
||||||
EXTERN long p_mouset; // 'mousetime'
|
EXTERN long p_mouset; // 'mousetime'
|
||||||
EXTERN int p_more; // 'more'
|
EXTERN int p_more; // 'more'
|
||||||
EXTERN long p_mhi; // 'msghistory'
|
|
||||||
#ifdef FEAT_MZSCHEME
|
#ifdef FEAT_MZSCHEME
|
||||||
EXTERN long p_mzq; // 'mzquantum
|
EXTERN long p_mzq; // 'mzquantum
|
||||||
# if defined(DYNAMIC_MZSCHEME)
|
# if defined(DYNAMIC_MZSCHEME)
|
||||||
|
@@ -1695,6 +1695,9 @@ static struct vimoption options[] =
|
|||||||
{"mesg", NULL, P_BOOL|P_VI_DEF,
|
{"mesg", NULL, P_BOOL|P_VI_DEF,
|
||||||
(char_u *)NULL, PV_NONE, NULL, NULL,
|
(char_u *)NULL, PV_NONE, NULL, NULL,
|
||||||
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
|
||||||
|
{"messagesopt","mopt", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_COLON|P_NODUP,
|
||||||
|
(char_u *)&p_meo, PV_NONE, did_set_messagesopt, expand_set_messagesopt,
|
||||||
|
{(char_u *)"hit-enter,history:500", (char_u *)NULL} SCTX_INIT},
|
||||||
{"mkspellmem", "msm", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE,
|
{"mkspellmem", "msm", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE,
|
||||||
#ifdef FEAT_SPELL
|
#ifdef FEAT_SPELL
|
||||||
(char_u *)&p_msm, PV_NONE, did_set_mkspellmem, NULL,
|
(char_u *)&p_msm, PV_NONE, did_set_mkspellmem, NULL,
|
||||||
@@ -1778,9 +1781,6 @@ static struct vimoption options[] =
|
|||||||
{"mousetime", "mouset", P_NUM|P_VI_DEF,
|
{"mousetime", "mouset", P_NUM|P_VI_DEF,
|
||||||
(char_u *)&p_mouset, PV_NONE, NULL, NULL,
|
(char_u *)&p_mouset, PV_NONE, NULL, NULL,
|
||||||
{(char_u *)500L, (char_u *)0L} SCTX_INIT},
|
{(char_u *)500L, (char_u *)0L} SCTX_INIT},
|
||||||
{"msghistory","mhi", P_NUM|P_VI_DEF,
|
|
||||||
(char_u *)&p_mhi, PV_NONE, did_set_msghistory, NULL,
|
|
||||||
{(char_u *)500L, (char_u *)0L} SCTX_INIT},
|
|
||||||
{"mzquantum", "mzq", P_NUM,
|
{"mzquantum", "mzq", P_NUM,
|
||||||
#ifdef FEAT_MZSCHEME
|
#ifdef FEAT_MZSCHEME
|
||||||
(char_u *)&p_mzq, PV_NONE, did_set_mzquantum, NULL,
|
(char_u *)&p_mzq, PV_NONE, did_set_mzquantum, NULL,
|
||||||
|
@@ -3040,6 +3040,30 @@ did_set_matchpairs(optset_T *args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Process the updated 'messagesopt' option value.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
did_set_messagesopt(optset_T *args UNUSED)
|
||||||
|
{
|
||||||
|
if (messagesopt_changed() == FAIL)
|
||||||
|
return e_invalid_argument;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
expand_set_messagesopt(optexpand_T *args, int *numMatches, char_u ***matches)
|
||||||
|
{
|
||||||
|
static char *(p_meo_values[]) = {"hit-enter", "wait:", "history:", NULL};
|
||||||
|
return expand_set_opt_string(
|
||||||
|
args,
|
||||||
|
p_meo_values,
|
||||||
|
ARRAY_LENGTH(p_meo_values) - 1,
|
||||||
|
numMatches,
|
||||||
|
matches);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(FEAT_SPELL) || defined(PROTO)
|
#if defined(FEAT_SPELL) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* The 'mkspellmem' option is changed.
|
* The 'mkspellmem' option is changed.
|
||||||
|
@@ -18,7 +18,7 @@ void emsg_namelen(char *msg, char_u *name, int len);
|
|||||||
char *msg_trunc_attr(char *s, int force, int attr);
|
char *msg_trunc_attr(char *s, int force, int attr);
|
||||||
char_u *msg_may_trunc(int force, char_u *s);
|
char_u *msg_may_trunc(int force, char_u *s);
|
||||||
int delete_first_msg(void);
|
int delete_first_msg(void);
|
||||||
void check_msg_hist(void);
|
int messagesopt_changed(void);
|
||||||
void ex_messages(exarg_T *eap);
|
void ex_messages(exarg_T *eap);
|
||||||
void msg_end_prompt(void);
|
void msg_end_prompt(void);
|
||||||
void wait_return(int redraw);
|
void wait_return(int redraw);
|
||||||
|
@@ -56,7 +56,6 @@ char *did_set_maxcombine(optset_T *args);
|
|||||||
char *did_set_modifiable(optset_T *args);
|
char *did_set_modifiable(optset_T *args);
|
||||||
char *did_set_modified(optset_T *args);
|
char *did_set_modified(optset_T *args);
|
||||||
char *did_set_mousehide(optset_T *args);
|
char *did_set_mousehide(optset_T *args);
|
||||||
char *did_set_msghistory(optset_T *args);
|
|
||||||
char *did_set_number_relativenumber(optset_T *args);
|
char *did_set_number_relativenumber(optset_T *args);
|
||||||
char *did_set_numberwidth(optset_T *args);
|
char *did_set_numberwidth(optset_T *args);
|
||||||
char *did_set_paste(optset_T *args);
|
char *did_set_paste(optset_T *args);
|
||||||
|
@@ -111,6 +111,8 @@ int expand_set_keyprotocol(optexpand_T *args, int *numMatches, char_u ***matches
|
|||||||
char *did_set_lispoptions(optset_T *args);
|
char *did_set_lispoptions(optset_T *args);
|
||||||
int expand_set_lispoptions(optexpand_T *args, int *numMatches, char_u ***matches);
|
int expand_set_lispoptions(optexpand_T *args, int *numMatches, char_u ***matches);
|
||||||
char *did_set_matchpairs(optset_T *args);
|
char *did_set_matchpairs(optset_T *args);
|
||||||
|
char *did_set_messagesopt(optset_T *args);
|
||||||
|
int expand_set_messagesopt(optexpand_T *args, int *numMatches, char_u ***matches);
|
||||||
char *did_set_mkspellmem(optset_T *args);
|
char *did_set_mkspellmem(optset_T *args);
|
||||||
char *did_set_mouse(optset_T *args);
|
char *did_set_mouse(optset_T *args);
|
||||||
int expand_set_mouse(optexpand_T *args, int *numMatches, char_u ***matches);
|
int expand_set_mouse(optexpand_T *args, int *numMatches, char_u ***matches);
|
||||||
|
@@ -85,7 +85,6 @@ let test_values = {
|
|||||||
\ 'imstyle': [[0, 1], [-1, 2, 999]],
|
\ 'imstyle': [[0, 1], [-1, 2, 999]],
|
||||||
\ 'lines': [[2, 24, 1000], [-1, 0, 1]],
|
\ 'lines': [[2, 24, 1000], [-1, 0, 1]],
|
||||||
\ 'linespace': [[-1, 0, 2, 4, 999], ['']],
|
\ 'linespace': [[-1, 0, 2, 4, 999], ['']],
|
||||||
\ 'msghistory': [[0, 1, 100, 10000], [-1, 10001]],
|
|
||||||
\ 'numberwidth': [[1, 4, 8, 10, 11, 20], [-1, 0, 21]],
|
\ 'numberwidth': [[1, 4, 8, 10, 11, 20], [-1, 0, 21]],
|
||||||
\ 'regexpengine': [[0, 1, 2], [-1, 3, 999]],
|
\ 'regexpengine': [[0, 1, 2], [-1, 3, 999]],
|
||||||
\ 'report': [[0, 1, 2, 9999], [-1]],
|
\ 'report': [[0, 1, 2, 9999], [-1]],
|
||||||
@@ -233,6 +232,11 @@ let test_values = {
|
|||||||
\ 'eol:\\u21b5', 'eol:\\U000021b5', 'eol:x,space:y'],
|
\ 'eol:\\u21b5', 'eol:\\U000021b5', 'eol:x,space:y'],
|
||||||
\ ['xxx', 'eol:']],
|
\ ['xxx', 'eol:']],
|
||||||
\ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']],
|
\ 'matchpairs': [['', '(:)', '(:),<:>'], ['xxx']],
|
||||||
|
\ 'messagesopt': [['hit-enter,history:1', 'hit-enter,history:10000',
|
||||||
|
\ 'history:100,wait:100', 'history:0,wait:0',
|
||||||
|
\ 'hit-enter,history:1,wait:1'],
|
||||||
|
\ ['xxx', 'history:500', 'hit-enter,history:-1',
|
||||||
|
\ 'hit-enter,history:10001', 'hit-enter']],
|
||||||
\ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']],
|
\ 'mkspellmem': [['10000,100,12'], ['', 'xxx', '10000,100']],
|
||||||
\ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'],
|
\ 'mouse': [['', 'n', 'v', 'i', 'c', 'h', 'a', 'r', 'nvi'],
|
||||||
\ ['xxx', 'n,v,i']],
|
\ ['xxx', 'n,v,i']],
|
||||||
|
@@ -4032,30 +4032,4 @@ func Test_cd_bslash_completion_windows()
|
|||||||
let &shellslash = save_shellslash
|
let &shellslash = save_shellslash
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_msghistory()
|
|
||||||
" After setting 'msghistory' to 2 and outputting a message 4 times with
|
|
||||||
" :echomsg, is the number of output lines of :messages 2?
|
|
||||||
set msghistory=2
|
|
||||||
echomsg 'foo'
|
|
||||||
echomsg 'bar'
|
|
||||||
echomsg 'baz'
|
|
||||||
echomsg 'foobar'
|
|
||||||
call assert_equal(['baz', 'foobar'], GetMessages())
|
|
||||||
|
|
||||||
" When the number of messages is 10 and 'msghistory' is changed to 5, is the
|
|
||||||
" number of output lines of :messages 5?
|
|
||||||
set msghistory=10
|
|
||||||
for num in range(1, 10)
|
|
||||||
echomsg num
|
|
||||||
endfor
|
|
||||||
set msghistory=5
|
|
||||||
call assert_equal(5, len(GetMessages()))
|
|
||||||
|
|
||||||
" Check empty list
|
|
||||||
set msghistory=0
|
|
||||||
call assert_true(empty(GetMessages()))
|
|
||||||
|
|
||||||
set msghistory&
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -211,6 +211,7 @@ endfunc
|
|||||||
" Test more-prompt (see :help more-prompt).
|
" Test more-prompt (see :help more-prompt).
|
||||||
func Test_message_more()
|
func Test_message_more()
|
||||||
CheckRunVimInTerminal
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
let buf = RunVimInTerminal('', {'rows': 6})
|
let buf = RunVimInTerminal('', {'rows': 6})
|
||||||
call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
|
call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
|
||||||
|
|
||||||
@@ -657,5 +658,50 @@ func Test_echowin_showmode()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_messagesopt_history()
|
||||||
|
" After setting 'messagesopt' "history" to 2 and outputting a message 4 times
|
||||||
|
" with :echomsg, is the number of output lines of :messages 2?
|
||||||
|
set messagesopt=hit-enter,history:2
|
||||||
|
echomsg 'foo'
|
||||||
|
echomsg 'bar'
|
||||||
|
echomsg 'baz'
|
||||||
|
echomsg 'foobar'
|
||||||
|
call assert_equal(['baz', 'foobar'], GetMessages())
|
||||||
|
|
||||||
|
" When the number of messages is 10 and 'messagesopt' "history" is changed to
|
||||||
|
" 5, is the number of output lines of :messages 5?
|
||||||
|
set messagesopt=hit-enter,history:10
|
||||||
|
for num in range(1, 10)
|
||||||
|
echomsg num
|
||||||
|
endfor
|
||||||
|
set messagesopt=hit-enter,history:5
|
||||||
|
call assert_equal(5, len(GetMessages()))
|
||||||
|
|
||||||
|
" Check empty list
|
||||||
|
set messagesopt=hit-enter,history:0
|
||||||
|
call assert_true(empty(GetMessages()))
|
||||||
|
|
||||||
|
set messagesopt&
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_messagesopt_wait()
|
||||||
|
CheckRunVimInTerminal
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('', {'rows': 6, 'cols': 45})
|
||||||
|
call term_sendkeys(buf, ":set cmdheight=1\n")
|
||||||
|
|
||||||
|
" Check hit-enter prompt
|
||||||
|
call term_sendkeys(buf, ":set messagesopt=hit-enter,history:500\n")
|
||||||
|
call term_sendkeys(buf, ":echo 'foo' | echo 'bar' echo 'baz'\n")
|
||||||
|
call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
|
||||||
|
|
||||||
|
" Check no hit-enter prompt when "wait:" is set
|
||||||
|
call term_sendkeys(buf, ":set messagesopt=wait:100,history:500\n")
|
||||||
|
call term_sendkeys(buf, ":echo 'foo' | echo 'bar' echo 'baz'\n")
|
||||||
|
call WaitForAssert({-> assert_equal(' 0,0-1 All', term_getline(buf, 6))})
|
||||||
|
|
||||||
|
" clean up
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -633,6 +633,10 @@ func Test_set_completion_string_values()
|
|||||||
call feedkeys(":set hl=8b i\<Left>\<Left>\<Tab>\<C-B>\"\<CR>", 'xt')
|
call feedkeys(":set hl=8b i\<Left>\<Left>\<Tab>\<C-B>\"\<CR>", 'xt')
|
||||||
call assert_equal("\"set hl=8bi i", @:)
|
call assert_equal("\"set hl=8bi i", @:)
|
||||||
|
|
||||||
|
" messagesopt
|
||||||
|
call assert_equal(['history:', 'hit-enter', 'wait:'],
|
||||||
|
\ getcompletion('set messagesopt+=', 'cmdline')->sort())
|
||||||
|
|
||||||
"
|
"
|
||||||
" Test flag lists
|
" Test flag lists
|
||||||
"
|
"
|
||||||
@@ -732,7 +736,6 @@ func Test_set_option_errors()
|
|||||||
call assert_fails('set backupcopy=', 'E474:')
|
call assert_fails('set backupcopy=', 'E474:')
|
||||||
call assert_fails('set regexpengine=3', 'E474:')
|
call assert_fails('set regexpengine=3', 'E474:')
|
||||||
call assert_fails('set history=10001', 'E474:')
|
call assert_fails('set history=10001', 'E474:')
|
||||||
call assert_fails('set msghistory=10001', 'E474:')
|
|
||||||
call assert_fails('set numberwidth=21', 'E474:')
|
call assert_fails('set numberwidth=21', 'E474:')
|
||||||
call assert_fails('set colorcolumn=-a', 'E474:')
|
call assert_fails('set colorcolumn=-a', 'E474:')
|
||||||
call assert_fails('set colorcolumn=a', 'E474:')
|
call assert_fails('set colorcolumn=a', 'E474:')
|
||||||
@@ -746,7 +749,6 @@ func Test_set_option_errors()
|
|||||||
endif
|
endif
|
||||||
call assert_fails('set helpheight=-1', 'E487:')
|
call assert_fails('set helpheight=-1', 'E487:')
|
||||||
call assert_fails('set history=-1', 'E487:')
|
call assert_fails('set history=-1', 'E487:')
|
||||||
call assert_fails('set msghistory=-1', 'E487:')
|
|
||||||
call assert_fails('set report=-1', 'E487:')
|
call assert_fails('set report=-1', 'E487:')
|
||||||
call assert_fails('set shiftwidth=-1', 'E487:')
|
call assert_fails('set shiftwidth=-1', 'E487:')
|
||||||
call assert_fails('set sidescroll=-1', 'E487:')
|
call assert_fails('set sidescroll=-1', 'E487:')
|
||||||
@@ -2509,6 +2511,7 @@ func Test_string_option_revert_on_failure()
|
|||||||
\ ['lispoptions', 'expr:1', 'a123'],
|
\ ['lispoptions', 'expr:1', 'a123'],
|
||||||
\ ['listchars', 'tab:->', 'tab:'],
|
\ ['listchars', 'tab:->', 'tab:'],
|
||||||
\ ['matchpairs', '<:>', '<:'],
|
\ ['matchpairs', '<:>', '<:'],
|
||||||
|
\ ['messagesopt', 'hit-enter,history:100', 'a123'],
|
||||||
\ ['mkspellmem', '100000,1000,100', '100000'],
|
\ ['mkspellmem', '100000,1000,100', '100000'],
|
||||||
\ ['mouse', 'nvi', 'z'],
|
\ ['mouse', 'nvi', 'z'],
|
||||||
\ ['mousemodel', 'extend', 'a123'],
|
\ ['mousemodel', 'extend', 'a123'],
|
||||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
908,
|
||||||
/**/
|
/**/
|
||||||
907,
|
907,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user