Skip to content

Commit 3161f66

Browse files
committed
updated for version 7.3.597
Problem: 'clipboard' "autoselect" only applies to the * register. (Sergey Vakulenko) Solution: Make 'autoselect' work for the + register. (Christian Brabant) Add the "autoselectplus" option in 'clipboard' and the "P" flag in 'guioptions'.
1 parent 2b1c1a2 commit 3161f66

File tree

10 files changed

+113
-58
lines changed

10 files changed

+113
-58
lines changed

runtime/doc/options.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,7 @@ A jump table for the options with a short description can be found at |Q_op|.
14521452
This option is a list of comma separated names.
14531453
These names are recognized:
14541454

1455+
*clipboard-unnamed*
14551456
unnamed When included, Vim will use the clipboard register '*'
14561457
for all yank, delete, change and put operations which
14571458
would normally go to the unnamed register. When a
@@ -1481,9 +1482,16 @@ A jump table for the options with a short description can be found at |Q_op|.
14811482
"autoselect" flag is used.
14821483
Also applies to the modeless selection.
14831484

1485+
*clipboard-autoselectplus*
1486+
autoselectplus Like "autoselect" but using the + register instead of
1487+
the * register. Compare to the 'P' flag in
1488+
'guioptions'.
1489+
1490+
*clipboard-autoselectml*
14841491
autoselectml Like "autoselect", but for the modeless selection
14851492
only. Compare to the 'A' flag in 'guioptions'.
14861493

1494+
*clipboard-html*
14871495
html When the clipboard contains HTML, use this when
14881496
pasting. When putting text on the clipboard, mark it
14891497
as HTML. This works to copy rendered HTML from
@@ -1494,6 +1502,7 @@ A jump table for the options with a short description can be found at |Q_op|.
14941502
Only supported for GTK version 2 and later.
14951503
Only available with the |+multi_byte| feature.
14961504

1505+
*clipboard-exclude*
14971506
exclude:{pattern}
14981507
Defines a pattern that is matched against the name of
14991508
the terminal 'term'. If there is a match, no
@@ -3589,6 +3598,9 @@ A jump table for the options with a short description can be found at |Q_op|.
35893598
windowing system's global selection unless explicitly told to
35903599
by a yank or delete operation for the "* register.
35913600
The same applies to the modeless selection.
3601+
*'go-P'*
3602+
'P' Like autoselect but using the "+ register instead of the "*
3603+
register.
35923604
*'go-A'*
35933605
'A' Autoselect for the modeless selection. Like 'a', but only
35943606
applies to the modeless selection.

src/globals.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ EXTERN VimClipboard clip_plus; /* CLIPBOARD selection in X11 */
517517
# define CLIP_UNNAMED_PLUS 2
518518
EXTERN int clip_unnamed INIT(= 0); /* above two values or'ed */
519519

520-
EXTERN int clip_autoselect INIT(= FALSE);
520+
EXTERN int clip_autoselect_star INIT(= FALSE);
521+
EXTERN int clip_autoselect_plus INIT(= FALSE);
521522
EXTERN int clip_autoselectml INIT(= FALSE);
522523
EXTERN int clip_html INIT(= FALSE);
523524
EXTERN regprog_T *clip_exclude_prog INIT(= NULL);

src/gui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3154,7 +3154,7 @@ gui_send_mouse_event(button, x, y, repeated_click, modifiers)
31543154
}
31553155

31563156
if (clip_star.state != SELECT_CLEARED && !did_clip)
3157-
clip_clear_selection();
3157+
clip_clear_selection(&clip_star);
31583158
#endif
31593159

31603160
/* Don't put events in the input queue now. */

src/normal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ do_pending_operator(cap, old_col, gui_yank)
14511451
* This could call do_pending_operator() recursively, but that's OK
14521452
* because gui_yank will be TRUE for the nested call.
14531453
*/
1454-
if (clip_star.available
1454+
if ((clip_star.available || clip_plus.available)
14551455
&& oap->op_type != OP_NOP
14561456
&& !gui_yank
14571457
# ifdef FEAT_VISUAL

src/ops.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,14 @@ get_register(name, copy)
962962
* selection too. */
963963
if (name == '*' && clip_star.available)
964964
{
965-
if (clip_isautosel())
966-
clip_update_selection();
965+
if (clip_isautosel_star())
966+
clip_update_selection(&clip_star);
967+
may_get_selection(name);
968+
}
969+
if (name == '+' && clip_plus.available)
970+
{
971+
if (clip_isautosel_plus())
972+
clip_update_selection(&clip_plus);
967973
may_get_selection(name);
968974
}
969975
#endif
@@ -3190,7 +3196,8 @@ op_yank(oap, deleting, mess)
31903196

31913197
clip_own_selection(&clip_plus);
31923198
clip_gen_set_selection(&clip_plus);
3193-
if (!clip_isautosel() && !did_star && curr == &(y_regs[PLUS_REGISTER]))
3199+
if (!clip_isautosel_star() && !did_star
3200+
&& curr == &(y_regs[PLUS_REGISTER]))
31943201
{
31953202
copy_yank_reg(&(y_regs[STAR_REGISTER]));
31963203
clip_own_selection(&clip_star);

src/option.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@
229229
#define GO_MENUS 'm' /* use menu bar */
230230
#define GO_NOSYSMENU 'M' /* don't source system menu */
231231
#define GO_POINTER 'p' /* pointer enter/leave callbacks */
232+
#define GO_ASELPLUS 'P' /* autoselectPlus */
232233
#define GO_RIGHT 'r' /* use right scrollbar */
233234
#define GO_VRIGHT 'R' /* right scrollbar with vert split */
234235
#define GO_TEAROFF 't' /* add tear-off menu items */

src/proto/ui.pro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ void ui_set_shellsize __ARGS((int mustset));
1111
void ui_new_shellsize __ARGS((void));
1212
void ui_breakcheck __ARGS((void));
1313
void clip_init __ARGS((int can_use));
14-
void clip_update_selection __ARGS((void));
14+
void clip_update_selection __ARGS((VimClipboard *clip));
1515
void clip_own_selection __ARGS((VimClipboard *cbd));
1616
void clip_lose_selection __ARGS((VimClipboard *cbd));
17-
void clip_copy_selection __ARGS((void));
1817
void clip_auto_select __ARGS((void));
19-
int clip_isautosel __ARGS((void));
18+
int clip_isautosel_star __ARGS((void));
19+
int clip_isautosel_plus __ARGS((void));
2020
void clip_modeless __ARGS((int button, int is_click, int is_drag));
2121
void clip_start_selection __ARGS((int col, int row, int repeated_click));
2222
void clip_process_selection __ARGS((int button, int col, int row, int_u repeated_click));
2323
void clip_may_redraw_selection __ARGS((int row, int col, int len));
24-
void clip_clear_selection __ARGS((void));
24+
void clip_clear_selection __ARGS((VimClipboard *cbd));
2525
void clip_may_clear_selection __ARGS((int row1, int row2));
2626
void clip_scroll_selection __ARGS((int rows));
2727
void clip_copy_modeless_selection __ARGS((int both));

src/screen.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,10 @@ update_screen(type)
519519
# endif
520520
# ifdef FEAT_CLIPBOARD
521521
/* When Visual area changed, may have to update selection. */
522-
if (clip_star.available && clip_isautosel())
523-
clip_update_selection();
522+
if (clip_star.available && clip_isautosel_star())
523+
clip_update_selection(&clip_star);
524+
if (clip_plus.available && clip_isautosel_plus())
525+
clip_update_selection(&clip_plus);
524526
# endif
525527
#ifdef FEAT_GUI
526528
/* Remove the cursor before starting to do anything, because
@@ -814,8 +816,10 @@ updateWindow(wp)
814816

815817
#ifdef FEAT_CLIPBOARD
816818
/* When Visual area changed, may have to update selection. */
817-
if (clip_star.available && clip_isautosel())
818-
clip_update_selection();
819+
if (clip_star.available && clip_isautosel_star())
820+
clip_update_selection(&clip_star);
821+
if (clip_plus.available && clip_isautosel_plus())
822+
clip_update_selection(&clip_plus);
819823
#endif
820824

821825
win_update(wp);
@@ -3000,7 +3004,10 @@ win_line(wp, lnum, startrow, endrow, nochange)
30003004
area_highlighting = TRUE;
30013005
attr = hl_attr(HLF_V);
30023006
#if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
3003-
if (clip_star.available && !clip_star.owned && clip_isautosel())
3007+
if ((clip_star.available && !clip_star.owned
3008+
&& clip_isautosel_star())
3009+
|| (clip_plus.available && !clip_plus.owned
3010+
&& clip_isautosel_plus()))
30043011
attr = hl_attr(HLF_VNC);
30053012
#endif
30063013
}
@@ -9060,7 +9067,7 @@ screen_ins_lines(off, row, line_count, end, wp)
90609067
|| (wp != NULL && wp->w_width != Columns)
90619068
# endif
90629069
)
9063-
clip_clear_selection();
9070+
clip_clear_selection(&clip_star);
90649071
else
90659072
clip_scroll_selection(-line_count);
90669073
#endif
@@ -9281,7 +9288,7 @@ screen_del_lines(off, row, line_count, end, force, wp)
92819288
|| (wp != NULL && wp->w_width != Columns)
92829289
# endif
92839290
)
9284-
clip_clear_selection();
9291+
clip_clear_selection(&clip_star);
92859292
else
92869293
clip_scroll_selection(line_count);
92879294
#endif

0 commit comments

Comments
 (0)