aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwatiko <service@mail.watiko.net>2016-02-15 22:40:55 +0900
committerwatiko <service@mail.watiko.net>2016-02-17 21:04:20 +0900
commit46128219462b44d4a5ae964b41812f6953753fed (patch)
tree4f621a3d8c28ebcc5c513c6e8ef9b6c061658f03
parent498eb020498010c157e453daa8a1f3a518a82ff3 (diff)
downloadrneovim-46128219462b44d4a5ae964b41812f6953753fed.tar.gz
rneovim-46128219462b44d4a5ae964b41812f6953753fed.tar.bz2
rneovim-46128219462b44d4a5ae964b41812f6953753fed.zip
vim-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 vim/vim#470) https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
-rw-r--r--runtime/doc/options.txt1
-rw-r--r--runtime/doc/repeat.txt6
-rw-r--r--src/nvim/ops.c11
-rw-r--r--src/nvim/option_defs.h3
-rw-r--r--src/nvim/screen.c39
-rw-r--r--src/nvim/version.c2
6 files changed, 39 insertions, 23 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index e875be6218..b5bda8ac05 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -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,
"-- XXX completion (YYY)", "match 1 of 2", "The only match",
"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
requires you to hit <Enter>, but still gives as useful a message as
diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt
index 21b5eef811..b2e935eb3f 100644
--- a/runtime/doc/repeat.txt
+++ b/runtime/doc/repeat.txt
@@ -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
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.
Implementation note: The 'q' that stops recording is
not stored in the register, unless it was the result
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index b1adc85e1d..0efce8c4c0 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -835,12 +835,13 @@ int do_record(int c)
yankreg_T *old_y_previous;
int retval;
- if (Recording == FALSE) { /* start recording */
- /* registers 0-9, a-z and " are allowed */
- if (c < 0 || (!ASCII_ISALNUM(c) && c != '"'))
+ if (Recording == false) {
+ // start recording
+ // registers 0-9, a-z and " are allowed
+ if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) {
retval = FAIL;
- else {
- Recording = TRUE;
+ } else {
+ Recording = c;
showmode();
regname = c;
retval = OK;
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 10706a0753..19edc14ed6 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -170,7 +170,8 @@
#define SHM_ATTENTION 'A' /* no ATTENTION messages */
#define SHM_INTRO 'I' /* intro messages */
#define SHM_COMPLETIONMENU 'c' // completion menu messages
-#define SHM_ALL "rmfixlnwaWtToOsAIc" /* all possible flags for 'shm' */
+#define SHM_RECORDING 'q' ///< short recording message
+#define SHM_ALL "rmfixlnwaWtToOsAIcq" ///< all possible flags for 'shm'
/* characters for p_go: */
#define GO_ASEL 'a' /* autoselect */
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 3b5836f0b5..382fcbac25 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -6760,8 +6760,8 @@ int showmode(void)
if (Recording
&& edit_submode == NULL /* otherwise it gets too long */
) {
- MSG_PUTS_ATTR(_("recording"), attr);
- need_clear = TRUE;
+ recording_mode(attr);
+ need_clear = true;
}
mode_displayed = TRUE;
@@ -6800,26 +6800,33 @@ static void msg_pos_mode(void)
msg_row = Rows - 1;
}
-/*
- * Delete mode message. Used when ESC is typed which is expected to end
- * Insert mode (but Insert mode didn't end yet!).
- * Caller should check "mode_displayed".
- */
-void unshowmode(int force)
+/// Delete mode message. Used when ESC is typed which is expected to end
+/// Insert mode (but Insert mode didn't end yet!).
+/// Caller should check "mode_displayed".
+void unshowmode(bool force)
{
- /*
- * 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 */
- else {
+ // 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
+ } else {
msg_pos_mode();
- if (Recording)
- MSG_PUTS_ATTR(_("recording"), hl_attr(HLF_CM));
+ if (Recording) {
+ recording_mode(hl_attr(HLF_CM));
+ }
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.
*/
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 39b8e3db84..874d10a44a 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -363,7 +363,7 @@ static int included_patches[] = {
// 928 NA
// 927 NA
// 926,
- // 925,
+ 925,
// 924 NA
// 923 NA
// 922,