Skip to content

Commit a0ed84a

Browse files
committed
patch 7.4.925
Problem: User may yank or put using the register being recorded in. Solution: Add the recording register in the message. (Christian Brabandt, closes #470)
1 parent 32d03b3 commit a0ed84a

6 files changed

Lines changed: 29 additions & 5 deletions

File tree

runtime/doc/options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6528,6 +6528,7 @@ A jump table for the options with a short description can be found at |Q_op|.
65286528
c don't give |ins-completion-menu| messages. For example,
65296529
"-- XXX completion (YYY)", "match 1 of 2", "The only match",
65306530
"Pattern not found", "Back at original", etc.
6531+
q use "recording" instead of "recording @a"
65316532

65326533
This gives you the opportunity to avoid that a change between buffers
65336534
requires you to hit <Enter>, but still gives as useful a message as

runtime/doc/repeat.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ To abort this type CTRL-C twice.
109109
q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"}
110110
(uppercase to append). The 'q' command is disabled
111111
while executing a register, and it doesn't work inside
112-
a mapping and |:normal|. {Vi: no recording}
112+
a mapping and |:normal|.
113+
114+
Note: If the register being used for recording is also
115+
used for |y| and |p| the result is most likely not
116+
what is expected, because the put will paste the
117+
recorded macro and the yank will overwrite the
118+
recorded macro. {Vi: no recording}
113119

114120
q Stops recording. (Implementation note: The 'q' that
115121
stops recording is not stored in the register, unless

src/ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ do_record(c)
10801080
retval = FAIL;
10811081
else
10821082
{
1083-
Recording = TRUE;
1083+
Recording = c;
10841084
showmode();
10851085
regname = c;
10861086
retval = OK;

src/option.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@
213213
#define SHM_ATTENTION 'A' /* no ATTENTION messages */
214214
#define SHM_INTRO 'I' /* intro messages */
215215
#define SHM_COMPLETIONMENU 'c' /* completion menu messages */
216-
#define SHM_ALL "rmfixlnwaWtToOsAIc" /* all possible flags for 'shm' */
216+
#define SHM_RECORDING 'q' /* short recording message */
217+
#define SHM_ALL "rmfixlnwaWtToOsAIcq" /* all possible flags for 'shm' */
217218

218219
/* characters for p_go: */
219220
#define GO_ASEL 'a' /* autoselect */

src/screen.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ static void redraw_block __ARGS((int row, int end, win_T *wp));
163163
static int win_do_lines __ARGS((win_T *wp, int row, int line_count, int mayclear, int del));
164164
static void win_rest_invalid __ARGS((win_T *wp));
165165
static void msg_pos_mode __ARGS((void));
166+
static void recording_mode __ARGS((int attr));
166167
#if defined(FEAT_WINDOWS)
167168
static void draw_tabline __ARGS((void));
168169
#endif
@@ -10163,7 +10164,7 @@ showmode()
1016310164
#endif
1016410165
)
1016510166
{
10166-
MSG_PUTS_ATTR(_("recording"), attr);
10167+
recording_mode(attr);
1016710168
need_clear = TRUE;
1016810169
}
1016910170

@@ -10227,11 +10228,24 @@ unshowmode(force)
1022710228
{
1022810229
msg_pos_mode();
1022910230
if (Recording)
10230-
MSG_PUTS_ATTR(_("recording"), hl_attr(HLF_CM));
10231+
recording_mode(hl_attr(HLF_CM));
1023110232
msg_clr_eos();
1023210233
}
1023310234
}
1023410235

10236+
static void
10237+
recording_mode(attr)
10238+
int attr;
10239+
{
10240+
MSG_PUTS_ATTR(_("recording"), attr);
10241+
if (!shortmess(SHM_RECORDING))
10242+
{
10243+
char_u s[4];
10244+
sprintf((char *)s, " @%c", Recording);
10245+
MSG_PUTS_ATTR(s, attr);
10246+
}
10247+
}
10248+
1023510249
#if defined(FEAT_WINDOWS)
1023610250
/*
1023710251
* Draw the tab pages line at the top of the Vim window.

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
925,
744746
/**/
745747
924,
746748
/**/

0 commit comments

Comments
 (0)