Mercurial > vim
comparison src/ops.c @ 2654:2b475ed86e64 v7.3.074
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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 02 Dec 2010 21:43:16 +0100 |
parents | e856f9cc2aee |
children | b93a3fc3897b |
comparison
equal
deleted
inserted
replaced
2653:ac04f392ba48 | 2654:2b475ed86e64 |
---|---|
1582 */ | 1582 */ |
1583 void | 1583 void |
1584 adjust_clip_reg(rp) | 1584 adjust_clip_reg(rp) |
1585 int *rp; | 1585 int *rp; |
1586 { | 1586 { |
1587 /* If no reg. specified, and "unnamed" is in 'clipboard', use '*' reg. */ | 1587 /* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard', |
1588 if (*rp == 0 && clip_unnamed) | 1588 * use '*' or '+' reg, respectively. "unnamedplus" prevails. */ |
1589 *rp = '*'; | 1589 if (*rp == 0 && clip_unnamed != 0) |
1590 *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available) | |
1591 ? '+' : '*'; | |
1590 if (!clip_star.available && *rp == '*') | 1592 if (!clip_star.available && *rp == '*') |
1591 *rp = 0; | 1593 *rp = 0; |
1592 if (!clip_plus.available && *rp == '+') | 1594 if (!clip_plus.available && *rp == '+') |
1593 *rp = 0; | 1595 *rp = 0; |
1594 } | 1596 } |
2840 long yanklines = oap->line_count; | 2842 long yanklines = oap->line_count; |
2841 linenr_T yankendlnum = oap->end.lnum; | 2843 linenr_T yankendlnum = oap->end.lnum; |
2842 char_u *p; | 2844 char_u *p; |
2843 char_u *pnew; | 2845 char_u *pnew; |
2844 struct block_def bd; | 2846 struct block_def bd; |
2847 int did_star = FALSE; | |
2845 | 2848 |
2846 /* check for read-only register */ | 2849 /* check for read-only register */ |
2847 if (oap->regname != 0 && !valid_yank_reg(oap->regname, TRUE)) | 2850 if (oap->regname != 0 && !valid_yank_reg(oap->regname, TRUE)) |
2848 { | 2851 { |
2849 beep_flush(); | 2852 beep_flush(); |
3113 * If no register was specified, and "unnamed" in 'clipboard', make a copy | 3116 * If no register was specified, and "unnamed" in 'clipboard', make a copy |
3114 * to the '*' register. | 3117 * to the '*' register. |
3115 */ | 3118 */ |
3116 if (clip_star.available | 3119 if (clip_star.available |
3117 && (curr == &(y_regs[STAR_REGISTER]) | 3120 && (curr == &(y_regs[STAR_REGISTER]) |
3118 || (!deleting && oap->regname == 0 && clip_unnamed))) | 3121 || (!deleting && oap->regname == 0 |
3122 && (clip_unnamed & CLIP_UNNAMED)))) | |
3119 { | 3123 { |
3120 if (curr != &(y_regs[STAR_REGISTER])) | 3124 if (curr != &(y_regs[STAR_REGISTER])) |
3121 /* Copy the text from register 0 to the clipboard register. */ | 3125 /* Copy the text from register 0 to the clipboard register. */ |
3122 copy_yank_reg(&(y_regs[STAR_REGISTER])); | 3126 copy_yank_reg(&(y_regs[STAR_REGISTER])); |
3123 | 3127 |
3124 clip_own_selection(&clip_star); | 3128 clip_own_selection(&clip_star); |
3125 clip_gen_set_selection(&clip_star); | 3129 clip_gen_set_selection(&clip_star); |
3130 did_star = TRUE; | |
3126 } | 3131 } |
3127 | 3132 |
3128 # ifdef FEAT_X11 | 3133 # ifdef FEAT_X11 |
3129 /* | 3134 /* |
3130 * If we were yanking to the '+' register, send result to selection. | 3135 * If we were yanking to the '+' register, send result to selection. |
3131 * Also copy to the '*' register, in case auto-select is off. | 3136 * Also copy to the '*' register, in case auto-select is off. |
3132 */ | 3137 */ |
3133 else if (clip_plus.available && curr == &(y_regs[PLUS_REGISTER])) | 3138 if (clip_plus.available |
3134 { | 3139 && (curr == &(y_regs[PLUS_REGISTER]) |
3140 || (!deleting && oap->regname == 0 | |
3141 && (clip_unnamed & CLIP_UNNAMED_PLUS)))) | |
3142 { | |
3143 if (curr != &(y_regs[PLUS_REGISTER])) | |
3144 /* Copy the text from register 0 to the clipboard register. */ | |
3145 copy_yank_reg(&(y_regs[PLUS_REGISTER])); | |
3146 | |
3135 /* No need to copy to * register upon 'unnamed' now - see below */ | 3147 /* No need to copy to * register upon 'unnamed' now - see below */ |
3136 clip_own_selection(&clip_plus); | 3148 clip_own_selection(&clip_plus); |
3137 clip_gen_set_selection(&clip_plus); | 3149 clip_gen_set_selection(&clip_plus); |
3138 if (!clip_isautosel()) | 3150 if (!clip_isautosel() && !did_star) |
3139 { | 3151 { |
3140 copy_yank_reg(&(y_regs[STAR_REGISTER])); | 3152 copy_yank_reg(&(y_regs[STAR_REGISTER])); |
3141 clip_own_selection(&clip_star); | 3153 clip_own_selection(&clip_star); |
3142 clip_gen_set_selection(&clip_star); | 3154 clip_gen_set_selection(&clip_star); |
3143 } | 3155 } |