mirror of
https://github.com/vim/vim.git
synced 2025-10-01 04:54:07 -04:00
updated for version 7.3.074
Problem: Can't use the "+ register like "* for yank and put. Solution: Add "unnamedplus" to the 'clipboard' option. (Ivan Krasilnikov)
This commit is contained in:
@@ -1434,6 +1434,15 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
explicitly accessed using the "* notation. Also see
|
explicitly accessed using the "* notation. Also see
|
||||||
|gui-clipboard|.
|
|gui-clipboard|.
|
||||||
|
|
||||||
|
unnamedplus A variant of "unnamed" flag which uses the clipboard
|
||||||
|
register '+' (|quoteplus|) instead of register '*' for
|
||||||
|
all operations except yank. Yank shall copy the text
|
||||||
|
into register '+' and also into '*' when "unnamed" is
|
||||||
|
included.
|
||||||
|
Only available with the |+x11| feature.
|
||||||
|
Availability can be checked with: >
|
||||||
|
if has('unnamedplus')
|
||||||
|
<
|
||||||
autoselect Works like the 'a' flag in 'guioptions': If present,
|
autoselect Works like the 'a' flag in 'guioptions': If present,
|
||||||
then whenever Visual mode is started, or the Visual
|
then whenever Visual mode is started, or the Visual
|
||||||
area extended, Vim tries to become the owner of the
|
area extended, Vim tries to become the owner of the
|
||||||
|
@@ -12135,6 +12135,9 @@ f_has(argvars, rettv)
|
|||||||
#ifdef FEAT_TOOLBAR
|
#ifdef FEAT_TOOLBAR
|
||||||
"toolbar",
|
"toolbar",
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
|
||||||
|
"unnamedplus",
|
||||||
|
#endif
|
||||||
#ifdef FEAT_USR_CMDS
|
#ifdef FEAT_USR_CMDS
|
||||||
"user-commands", /* was accidentally included in 5.4 */
|
"user-commands", /* was accidentally included in 5.4 */
|
||||||
"user_commands",
|
"user_commands",
|
||||||
|
@@ -512,7 +512,11 @@ EXTERN VimClipboard clip_plus; /* CLIPBOARD selection in X11 */
|
|||||||
# define clip_plus clip_star /* there is only one clipboard */
|
# define clip_plus clip_star /* there is only one clipboard */
|
||||||
# define ONE_CLIPBOARD
|
# define ONE_CLIPBOARD
|
||||||
# endif
|
# endif
|
||||||
EXTERN int clip_unnamed INIT(= FALSE);
|
|
||||||
|
#define CLIP_UNNAMED 1
|
||||||
|
#define CLIP_UNNAMED_PLUS 2
|
||||||
|
EXTERN int clip_unnamed INIT(= 0); /* above two values or'ed */
|
||||||
|
|
||||||
EXTERN int clip_autoselect INIT(= FALSE);
|
EXTERN int clip_autoselect INIT(= FALSE);
|
||||||
EXTERN int clip_autoselectml INIT(= FALSE);
|
EXTERN int clip_autoselectml INIT(= FALSE);
|
||||||
EXTERN int clip_html INIT(= FALSE);
|
EXTERN int clip_html INIT(= FALSE);
|
||||||
|
24
src/ops.c
24
src/ops.c
@@ -1584,9 +1584,11 @@ cmdline_paste_reg(regname, literally, remcr)
|
|||||||
adjust_clip_reg(rp)
|
adjust_clip_reg(rp)
|
||||||
int *rp;
|
int *rp;
|
||||||
{
|
{
|
||||||
/* If no reg. specified, and "unnamed" is in 'clipboard', use '*' reg. */
|
/* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard',
|
||||||
if (*rp == 0 && clip_unnamed)
|
* use '*' or '+' reg, respectively. "unnamedplus" prevails. */
|
||||||
*rp = '*';
|
if (*rp == 0 && clip_unnamed != 0)
|
||||||
|
*rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
|
||||||
|
? '+' : '*';
|
||||||
if (!clip_star.available && *rp == '*')
|
if (!clip_star.available && *rp == '*')
|
||||||
*rp = 0;
|
*rp = 0;
|
||||||
if (!clip_plus.available && *rp == '+')
|
if (!clip_plus.available && *rp == '+')
|
||||||
@@ -2842,6 +2844,7 @@ op_yank(oap, deleting, mess)
|
|||||||
char_u *p;
|
char_u *p;
|
||||||
char_u *pnew;
|
char_u *pnew;
|
||||||
struct block_def bd;
|
struct block_def bd;
|
||||||
|
int did_star = FALSE;
|
||||||
|
|
||||||
/* check for read-only register */
|
/* check for read-only register */
|
||||||
if (oap->regname != 0 && !valid_yank_reg(oap->regname, TRUE))
|
if (oap->regname != 0 && !valid_yank_reg(oap->regname, TRUE))
|
||||||
@@ -3115,7 +3118,8 @@ op_yank(oap, deleting, mess)
|
|||||||
*/
|
*/
|
||||||
if (clip_star.available
|
if (clip_star.available
|
||||||
&& (curr == &(y_regs[STAR_REGISTER])
|
&& (curr == &(y_regs[STAR_REGISTER])
|
||||||
|| (!deleting && oap->regname == 0 && clip_unnamed)))
|
|| (!deleting && oap->regname == 0
|
||||||
|
&& (clip_unnamed & CLIP_UNNAMED))))
|
||||||
{
|
{
|
||||||
if (curr != &(y_regs[STAR_REGISTER]))
|
if (curr != &(y_regs[STAR_REGISTER]))
|
||||||
/* Copy the text from register 0 to the clipboard register. */
|
/* Copy the text from register 0 to the clipboard register. */
|
||||||
@@ -3123,6 +3127,7 @@ op_yank(oap, deleting, mess)
|
|||||||
|
|
||||||
clip_own_selection(&clip_star);
|
clip_own_selection(&clip_star);
|
||||||
clip_gen_set_selection(&clip_star);
|
clip_gen_set_selection(&clip_star);
|
||||||
|
did_star = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_X11
|
# ifdef FEAT_X11
|
||||||
@@ -3130,12 +3135,19 @@ op_yank(oap, deleting, mess)
|
|||||||
* If we were yanking to the '+' register, send result to selection.
|
* If we were yanking to the '+' register, send result to selection.
|
||||||
* Also copy to the '*' register, in case auto-select is off.
|
* Also copy to the '*' register, in case auto-select is off.
|
||||||
*/
|
*/
|
||||||
else if (clip_plus.available && curr == &(y_regs[PLUS_REGISTER]))
|
if (clip_plus.available
|
||||||
|
&& (curr == &(y_regs[PLUS_REGISTER])
|
||||||
|
|| (!deleting && oap->regname == 0
|
||||||
|
&& (clip_unnamed & CLIP_UNNAMED_PLUS))))
|
||||||
{
|
{
|
||||||
|
if (curr != &(y_regs[PLUS_REGISTER]))
|
||||||
|
/* Copy the text from register 0 to the clipboard register. */
|
||||||
|
copy_yank_reg(&(y_regs[PLUS_REGISTER]));
|
||||||
|
|
||||||
/* No need to copy to * register upon 'unnamed' now - see below */
|
/* No need to copy to * register upon 'unnamed' now - see below */
|
||||||
clip_own_selection(&clip_plus);
|
clip_own_selection(&clip_plus);
|
||||||
clip_gen_set_selection(&clip_plus);
|
clip_gen_set_selection(&clip_plus);
|
||||||
if (!clip_isautosel())
|
if (!clip_isautosel() && !did_star)
|
||||||
{
|
{
|
||||||
copy_yank_reg(&(y_regs[STAR_REGISTER]));
|
copy_yank_reg(&(y_regs[STAR_REGISTER]));
|
||||||
clip_own_selection(&clip_star);
|
clip_own_selection(&clip_star);
|
||||||
|
10
src/option.c
10
src/option.c
@@ -7307,7 +7307,7 @@ check_stl_option(s)
|
|||||||
static char_u *
|
static char_u *
|
||||||
check_clipboard_option()
|
check_clipboard_option()
|
||||||
{
|
{
|
||||||
int new_unnamed = FALSE;
|
int new_unnamed = 0;
|
||||||
int new_autoselect = FALSE;
|
int new_autoselect = FALSE;
|
||||||
int new_autoselectml = FALSE;
|
int new_autoselectml = FALSE;
|
||||||
int new_html = FALSE;
|
int new_html = FALSE;
|
||||||
@@ -7319,9 +7319,15 @@ check_clipboard_option()
|
|||||||
{
|
{
|
||||||
if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
|
if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
|
||||||
{
|
{
|
||||||
new_unnamed = TRUE;
|
new_unnamed |= CLIP_UNNAMED;
|
||||||
p += 7;
|
p += 7;
|
||||||
}
|
}
|
||||||
|
else if (STRNCMP(p, "unnamedplus", 11) == 0
|
||||||
|
&& (p[11] == ',' || p[11] == NUL))
|
||||||
|
{
|
||||||
|
new_unnamed |= CLIP_UNNAMED_PLUS;
|
||||||
|
p += 11;
|
||||||
|
}
|
||||||
else if (STRNCMP(p, "autoselect", 10) == 0
|
else if (STRNCMP(p, "autoselect", 10) == 0
|
||||||
&& (p[10] == ',' || p[10] == NUL))
|
&& (p[10] == ',' || p[10] == NUL))
|
||||||
{
|
{
|
||||||
|
@@ -714,6 +714,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
74,
|
||||||
/**/
|
/**/
|
||||||
73,
|
73,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user