Allow select of yank buffer for ;y hinting (#151).
authorDaniel Carl <danielcarl@gmx.de>
Wed, 19 Nov 2014 23:02:48 +0000 (00:02 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Wed, 19 Nov 2014 23:14:46 +0000 (00:14 +0100)
doc/vimb.1
src/hints.c
src/main.h
src/normal.c

index dca3b84..4e4647d 100644 (file)
@@ -311,12 +311,13 @@ feature.
 Hints like ;o, but instead of opening the hinted URI, the
 `x-hint-command' is run in vimb.
 .TP
-.B ;y
-Yank hint's destination location into primary and secondary clipboard.
+.BI [ \[char34]x ];y
+Yank hint's destination location into primary and secondary clipboard and into
+the register \fIx\fP.
 .TP
-.B ;Y
+.BI [ \[char34]x ];Y
 Yank hint's text description or form text into primary and secondary
-clipboard.
+clipboard and into the register \fIx\fP.
 .PD
 .RE
 .TP
index 0917d97..516f204 100644 (file)
@@ -353,7 +353,7 @@ static gboolean call_hints_function(const char *func, int count, JSValueRef para
             case 'Y':
                 a.i = COMMAND_YANK_ARG;
                 a.s = v;
-                command_yank(&a, '\0');
+                command_yank(&a, vb.state.current_register);
                 break;
 
 #ifdef FEATURE_QUEUE
index 0144a54..4c1e284 100644 (file)
@@ -300,6 +300,7 @@ typedef struct {
     char            *linkhover;             /* the uri of the curret hovered link */
     char            *reg[VB_REG_SIZE];      /* holds the yank buffer */
     gboolean        enable_register;        /* indicates if registers are filled */
+    char            current_register;       /* holds char for current register to be used */
     gboolean        enable_history;         /* indicates if history entries are written */
 #ifdef FEATURE_SEARCH_HIGHLIGHT
     int             search_matches;         /* number of matches search results */
index 9d78f63..2e9d507 100644 (file)
@@ -438,6 +438,12 @@ static VbResult normal_hint(const NormalCmdInfo *info)
 {
     const char prompt[3] = {info->key, info->key2, 0};
 
+    /* Save the current cutbuf char to make it available in case of ;y
+     * hinting. This is only a hack, because we don't need this state variable
+     * somewhere else - it's only use is for hinting. It might be better to
+     * allow to set various data to the mode itself to avoid toggling
+     * variables in global skope. */
+    vb.state.current_register = info->cutbuf;
     return normal_do_hint(prompt);
 }