On 09/26/2011 10:21 PM, Bram Moolenaar wrote:

Ingo Karkat wrote:

Hello Vim developers,

The current discussion about v:register and "unnamedplus" reminded me of
a patch I had sent some time ago. It used to be in the todo list, but
apparently isn't any more. (Maybe it was accidentally removed when Bram
accepted another related same-day patch from me.)

To recap, I'd like to improve the help text for v:register and correct
the edge case of v:register value immediately after startup. Old message
and revised help text suggestion below.

Please make this patch against the latest version.  I did include some
of it.

Ah, sorry. It's hard to keep up with the runtime updates, as you do them in batches, not atomic commits referencing the patch or origin. I'm fine with the updated help text, so there's only the issue of the initial (empty) value of v:register immediately after startup. Granted, it's an edge case that only occurs when the very first command given is a custom normal mode mapping that uses v:register, but a bug nonetheless. This patch, updated against 7.3.322, fixes it.

-- regards, ingo

diff -r 5e84f6567623 src/eval.c
--- a/src/eval.c        Wed Sep 21 20:09:42 2011 +0200
+++ b/src/eval.c        Tue Sep 27 04:59:03 2011 +0200
@@ -872,6 +872,7 @@
            hash_add(&compat_hashtab, p->vv_di.di_key);
     }
     set_vim_var_nr(VV_SEARCHFORWARD, 1L);
+    set_reg_var(0);

 #ifdef EBCDIC
     /*
diff -r 5e84f6567623 src/main.c
--- a/src/main.c        Wed Sep 21 20:09:42 2011 +0200
+++ b/src/main.c        Tue Sep 27 04:59:03 2011 +0200
@@ -903,6 +903,16 @@
     TIME_MSG("VimEnter autocommands");
 #endif

+#if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD)
+ /* Adjust default register name for "unnamed" in 'clipboard'. Can only be + * done after the clipboard is available and all initial commands that may + * modify the 'clipboard' setting have run; i.e. just before entering the
+     * main loop. */
+    int default_regname = 0;
+    adjust_clip_reg(&default_regname);
+    set_reg_var(default_regname);
+#endif
+
 #if defined(FEAT_DIFF) && defined(FEAT_SCROLLBIND)
     /* When a startup script or session file setup for diff'ing and
      * scrollbind, sync the scrollbind now. */

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to