1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Can't use the "+ register like "* for yank and put.
12 Solution: Add "unnamedplus" to the 'clipboard' option. (Ivan Krasilnikov)
13 Files: runtime/doc/options.txt, src/eval.c, src/globals.h, src/ops.c,
17 *** ../vim-7.3.073/runtime/doc/options.txt 2010-12-02 16:01:23.000000000 +0100
18 --- runtime/doc/options.txt 2010-12-02 21:22:48.000000000 +0100
22 explicitly accessed using the "* notation. Also see
25 + unnamedplus A variant of "unnamed" flag which uses the clipboard
26 + register '+' (|quoteplus|) instead of register '*' for
27 + all operations except yank. Yank shall copy the text
28 + into register '+' and also into '*' when "unnamed" is
30 + Only available with the |+x11| feature.
31 + Availability can be checked with: >
32 + if has('unnamedplus')
34 autoselect Works like the 'a' flag in 'guioptions': If present,
35 then whenever Visual mode is started, or the Visual
36 area extended, Vim tries to become the owner of the
37 *** ../vim-7.3.073/src/eval.c 2010-12-02 14:47:56.000000000 +0100
38 --- src/eval.c 2010-12-02 17:30:23.000000000 +0100
45 + #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
49 "user-commands", /* was accidentally included in 5.4 */
51 *** ../vim-7.3.073/src/globals.h 2010-11-24 14:28:53.000000000 +0100
52 --- src/globals.h 2010-12-02 20:07:42.000000000 +0100
55 # define clip_plus clip_star /* there is only one clipboard */
56 # define ONE_CLIPBOARD
58 ! EXTERN int clip_unnamed INIT(= FALSE);
59 EXTERN int clip_autoselect INIT(= FALSE);
60 EXTERN int clip_autoselectml INIT(= FALSE);
61 EXTERN int clip_html INIT(= FALSE);
63 # define clip_plus clip_star /* there is only one clipboard */
64 # define ONE_CLIPBOARD
67 ! #define CLIP_UNNAMED 1
68 ! #define CLIP_UNNAMED_PLUS 2
69 ! EXTERN int clip_unnamed INIT(= 0); /* above two values or'ed */
71 EXTERN int clip_autoselect INIT(= FALSE);
72 EXTERN int clip_autoselectml INIT(= FALSE);
73 EXTERN int clip_html INIT(= FALSE);
74 *** ../vim-7.3.073/src/ops.c 2010-11-24 14:28:53.000000000 +0100
75 --- src/ops.c 2010-12-02 21:33:04.000000000 +0100
81 ! /* If no reg. specified, and "unnamed" is in 'clipboard', use '*' reg. */
82 ! if (*rp == 0 && clip_unnamed)
84 if (!clip_star.available && *rp == '*')
86 if (!clip_plus.available && *rp == '+')
91 ! /* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard',
92 ! * use '*' or '+' reg, respectively. "unnamedplus" prevails. */
93 ! if (*rp == 0 && clip_unnamed != 0)
94 ! *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
96 if (!clip_star.available && *rp == '*')
98 if (!clip_plus.available && *rp == '+')
105 + int did_star = FALSE;
107 /* check for read-only register */
108 if (oap->regname != 0 && !valid_yank_reg(oap->regname, TRUE))
112 if (clip_star.available
113 && (curr == &(y_regs[STAR_REGISTER])
114 ! || (!deleting && oap->regname == 0 && clip_unnamed)))
116 if (curr != &(y_regs[STAR_REGISTER]))
117 /* Copy the text from register 0 to the clipboard register. */
120 if (clip_star.available
121 && (curr == &(y_regs[STAR_REGISTER])
122 ! || (!deleting && oap->regname == 0
123 ! && (clip_unnamed & CLIP_UNNAMED))))
125 if (curr != &(y_regs[STAR_REGISTER]))
126 /* Copy the text from register 0 to the clipboard register. */
131 clip_own_selection(&clip_star);
132 clip_gen_set_selection(&clip_star);
139 * If we were yanking to the '+' register, send result to selection.
140 * Also copy to the '*' register, in case auto-select is off.
142 ! else if (clip_plus.available && curr == &(y_regs[PLUS_REGISTER]))
144 /* No need to copy to * register upon 'unnamed' now - see below */
145 clip_own_selection(&clip_plus);
146 clip_gen_set_selection(&clip_plus);
147 ! if (!clip_isautosel())
149 copy_yank_reg(&(y_regs[STAR_REGISTER]));
150 clip_own_selection(&clip_star);
152 * If we were yanking to the '+' register, send result to selection.
153 * Also copy to the '*' register, in case auto-select is off.
155 ! if (clip_plus.available
156 ! && (curr == &(y_regs[PLUS_REGISTER])
157 ! || (!deleting && oap->regname == 0
158 ! && (clip_unnamed & CLIP_UNNAMED_PLUS))))
160 + if (curr != &(y_regs[PLUS_REGISTER]))
161 + /* Copy the text from register 0 to the clipboard register. */
162 + copy_yank_reg(&(y_regs[PLUS_REGISTER]));
164 /* No need to copy to * register upon 'unnamed' now - see below */
165 clip_own_selection(&clip_plus);
166 clip_gen_set_selection(&clip_plus);
167 ! if (!clip_isautosel() && !did_star)
169 copy_yank_reg(&(y_regs[STAR_REGISTER]));
170 clip_own_selection(&clip_star);
171 *** ../vim-7.3.073/src/option.c 2010-12-02 16:01:23.000000000 +0100
172 --- src/option.c 2010-12-02 21:41:32.000000000 +0100
176 check_clipboard_option()
178 ! int new_unnamed = FALSE;
179 int new_autoselect = FALSE;
180 int new_autoselectml = FALSE;
181 int new_html = FALSE;
184 check_clipboard_option()
186 ! int new_unnamed = 0;
187 int new_autoselect = FALSE;
188 int new_autoselectml = FALSE;
189 int new_html = FALSE;
193 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
195 ! new_unnamed = TRUE;
198 else if (STRNCMP(p, "autoselect", 10) == 0
199 && (p[10] == ',' || p[10] == NUL))
203 if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
205 ! new_unnamed |= CLIP_UNNAMED;
208 + else if (STRNCMP(p, "unnamedplus", 11) == 0
209 + && (p[11] == ',' || p[11] == NUL))
211 + new_unnamed |= CLIP_UNNAMED_PLUS;
214 else if (STRNCMP(p, "autoselect", 10) == 0
215 && (p[10] == ',' || p[10] == NUL))
217 *** ../vim-7.3.073/src/version.c 2010-12-02 17:09:48.000000000 +0100
218 --- src/version.c 2010-12-02 21:34:40.000000000 +0100
222 { /* Add new patch number below this line */
228 The budget process was invented by an alien race of sadistic beings who
230 (Scott Adams - The Dilbert principle)
232 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
233 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
234 \\\ an exciting new programming language -- http://www.Zimbu.org ///
235 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///