Merge #4265 'vim-patch:7.4.925'.

This commit is contained in:
Justin M. Keyes 2016-03-02 01:24:38 -05:00
commit 56bfdd7934
7 changed files with 78 additions and 50 deletions

View File

@ -5538,6 +5538,7 @@ A jump table for the options with a short description can be found at |Q_op|.
c don't give |ins-completion-menu| messages. For example, c don't give |ins-completion-menu| messages. For example,
"-- XXX completion (YYY)", "match 1 of 2", "The only match", "-- XXX completion (YYY)", "match 1 of 2", "The only match",
"Pattern not found", "Back at original", etc. "Pattern not found", "Back at original", etc.
q use "recording" instead of "recording @a"
This gives you the opportunity to avoid that a change between buffers This gives you the opportunity to avoid that a change between buffers
requires you to hit <Enter>, but still gives as useful a message as requires you to hit <Enter>, but still gives as useful a message as

View File

@ -109,6 +109,12 @@ q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"}
while executing a register, and it doesn't work inside while executing a register, and it doesn't work inside
a mapping and |:normal|. a mapping and |:normal|.
Note: If the register being used for recording is also
used for |y| and |p| the result is most likely not
what is expected, because the put will paste the
recorded macro and the yank will overwrite the
recorded macro.
q Stops recording. q Stops recording.
Implementation note: The 'q' that stops recording is Implementation note: The 'q' that stops recording is
not stored in the register, unless it was the result not stored in the register, unless it was the result

View File

@ -836,12 +836,13 @@ int do_record(int c)
yankreg_T *old_y_previous; yankreg_T *old_y_previous;
int retval; int retval;
if (Recording == FALSE) { /* start recording */ if (Recording == false) {
/* registers 0-9, a-z and " are allowed */ // start recording
if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) // registers 0-9, a-z and " are allowed
if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) {
retval = FAIL; retval = FAIL;
else { } else {
Recording = TRUE; Recording = c;
showmode(); showmode();
regname = c; regname = c;
retval = OK; retval = OK;

View File

@ -6167,16 +6167,14 @@ int has_format_option(int x)
return vim_strchr(curbuf->b_p_fo, x) != NULL; return vim_strchr(curbuf->b_p_fo, x) != NULL;
} }
/* /// @returns true if "x" is present in 'shortmess' option, or
* Return TRUE if "x" is present in 'shortmess' option, or /// 'shortmess' contains 'a' and "x" is present in SHM_ALL_ABBREVIATIONS.
* 'shortmess' contains 'a' and "x" is present in SHM_A. bool shortmess(int x)
*/
int shortmess(int x)
{ {
return p_shm != NULL && return p_shm != NULL &&
( vim_strchr(p_shm, x) != NULL (vim_strchr(p_shm, x) != NULL
|| (vim_strchr(p_shm, 'a') != NULL || (vim_strchr(p_shm, 'a') != NULL
&& vim_strchr((char_u *)SHM_A, x) != NULL)); && vim_strchr((char_u *)SHM_ALL_ABBREVIATIONS, x) != NULL));
} }
/* /*

View File

@ -151,26 +151,41 @@
#define COCU_ALL "nvic" /* flags for 'concealcursor' */ #define COCU_ALL "nvic" /* flags for 'concealcursor' */
/* characters for p_shm option: */ /// characters for p_shm option:
#define SHM_RO 'r' /* readonly */ enum {
#define SHM_MOD 'm' /* modified */ SHM_RO = 'r', ///< Readonly.
#define SHM_FILE 'f' /* (file 1 of 2) */ SHM_MOD = 'm', ///< Modified.
#define SHM_LAST 'i' /* last line incomplete */ SHM_FILE = 'f', ///< (file 1 of 2)
#define SHM_TEXT 'x' /* tx instead of textmode */ SHM_LAST = 'i', ///< Last line incomplete.
#define SHM_LINES 'l' /* "L" instead of "lines" */ SHM_TEXT = 'x', ///< Tx instead of textmode.
#define SHM_NEW 'n' /* "[New]" instead of "[New file]" */ SHM_LINES = 'l', ///< "L" instead of "lines".
#define SHM_WRI 'w' /* "[w]" instead of "written" */ SHM_NEW = 'n', ///< "[New]" instead of "[New file]".
#define SHM_A "rmfixlnw" /* represented by 'a' flag */ SHM_WRI = 'w', ///< "[w]" instead of "written".
#define SHM_WRITE 'W' /* don't use "written" at all */ SHM_ABBREVIATIONS = 'a', ///< Use abbreviations from #SHM_ALL_ABBREVIATIONS.
#define SHM_TRUNC 't' /* trunctate file messages */ SHM_WRITE = 'W', ///< Don't use "written" at all.
#define SHM_TRUNCALL 'T' /* trunctate all messages */ SHM_TRUNC = 't', ///< Trunctate file messages.
#define SHM_OVER 'o' /* overwrite file messages */ SHM_TRUNCALL = 'T', ///< Trunctate all messages.
#define SHM_OVERALL 'O' /* overwrite more messages */ SHM_OVER = 'o', ///< Overwrite file messages.
#define SHM_SEARCH 's' /* no search hit bottom messages */ SHM_OVERALL = 'O', ///< Overwrite more messages.
#define SHM_ATTENTION 'A' /* no ATTENTION messages */ SHM_SEARCH = 's', ///< No search hit bottom messages.
#define SHM_INTRO 'I' /* intro messages */ SHM_ATTENTION = 'A', ///< No ATTENTION messages.
#define SHM_COMPLETIONMENU 'c' // completion menu messages SHM_INTRO = 'I', ///< Intro messages.
#define SHM_ALL "rmfixlnwaWtToOsAIc" /* all possible flags for 'shm' */ SHM_COMPLETIONMENU = 'c', ///< Completion menu messages.
SHM_RECORDING = 'q', ///< Short recording message.
};
/// Represented by 'a' flag.
#define SHM_ALL_ABBREVIATIONS ((char_u[]) { \
SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \
0, \
})
/// All possible flags for 'shm'.
#define SHM_ALL ((char_u[]) { \
SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \
SHM_ABBREVIATIONS, SHM_WRITE, SHM_TRUNC, SHM_TRUNCALL, SHM_OVER, \
SHM_OVERALL, SHM_SEARCH, SHM_ATTENTION, SHM_INTRO, SHM_COMPLETIONMENU, \
SHM_RECORDING, \
0, \
})
/* characters for p_go: */ /* characters for p_go: */
#define GO_ASEL 'a' /* autoselect */ #define GO_ASEL 'a' /* autoselect */

View File

@ -6780,8 +6780,8 @@ int showmode(void)
if (Recording if (Recording
&& edit_submode == NULL /* otherwise it gets too long */ && edit_submode == NULL /* otherwise it gets too long */
) { ) {
MSG_PUTS_ATTR(_("recording"), attr); recording_mode(attr);
need_clear = TRUE; need_clear = true;
} }
mode_displayed = TRUE; mode_displayed = TRUE;
@ -6820,26 +6820,33 @@ static void msg_pos_mode(void)
msg_row = Rows - 1; msg_row = Rows - 1;
} }
/* /// Delete mode message. Used when ESC is typed which is expected to end
* Delete mode message. Used when ESC is typed which is expected to end /// Insert mode (but Insert mode didn't end yet!).
* Insert mode (but Insert mode didn't end yet!). /// Caller should check "mode_displayed".
* Caller should check "mode_displayed". void unshowmode(bool force)
*/
void unshowmode(int force)
{ {
/* // Don't delete it right now, when not redrawing or inside a mapping.
* Don't delete it right now, when not redrawing or inside a mapping. if (!redrawing() || (!force && char_avail() && !KeyTyped)) {
*/ redraw_cmdline = true; // delete mode later
if (!redrawing() || (!force && char_avail() && !KeyTyped)) } else {
redraw_cmdline = TRUE; /* delete mode later */
else {
msg_pos_mode(); msg_pos_mode();
if (Recording) if (Recording) {
MSG_PUTS_ATTR(_("recording"), hl_attr(HLF_CM)); recording_mode(hl_attr(HLF_CM));
}
msg_clr_eos(); msg_clr_eos();
} }
} }
static void recording_mode(int attr)
{
MSG_PUTS_ATTR(_("recording"), attr);
if (!shortmess(SHM_RECORDING)) {
char_u s[4];
vim_snprintf((char *)s, ARRAY_SIZE(s), " @%c", Recording);
MSG_PUTS_ATTR(s, attr);
}
}
/* /*
* Draw the tab pages line at the top of the Vim window. * Draw the tab pages line at the top of the Vim window.
*/ */

View File

@ -365,7 +365,7 @@ static int included_patches[] = {
// 928 NA // 928 NA
// 927 NA // 927 NA
926, 926,
// 925, 925,
// 924 NA // 924 NA
// 923 NA // 923 NA
922, 922,