Skip to content

Commit bde5832

Browse files
64-bitmanchrisbra
authored andcommitted
patch 9.2.0249: clipboard: provider reacts to autoselect feature
Problem: clipboard: provider reacts to autoselect feature Solution: Disable autoselection when using clipboard provider feature (Foxe Chen). closes: #19812 Signed-off-by: Foxe Chen <chen.foxe@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent af3ccc2 commit bde5832

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

src/clipboard.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ clip_auto_select(void)
452452
int
453453
clip_isautosel_star(void)
454454
{
455+
# ifdef FEAT_CLIPBOARD_PROVIDER
456+
if (clipmethod == CLIPMETHOD_PROVIDER)
457+
return false;
458+
# endif
455459
# ifdef FEAT_GUI
456460
if (gui.in_use)
457461
return vim_strchr(p_go, GO_ASEL) != NULL
@@ -467,6 +471,10 @@ clip_isautosel_star(void)
467471
int
468472
clip_isautosel_plus(void)
469473
{
474+
# ifdef FEAT_CLIPBOARD_PROVIDER
475+
if (clipmethod == CLIPMETHOD_PROVIDER)
476+
return false;
477+
# endif
470478
# ifdef FEAT_GUI
471479
if (gui.in_use)
472480
return vim_strchr(p_go, GO_ASELPLUS) != NULL;

src/testdir/test_eval_stuff.vim

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ func Test_clipboard_provider_redir_execute()
12231223
endfunc
12241224

12251225
" Test if clipboard provider feature respects the "unnamed" and "unnamedplus"
1226-
" values in the 'clipboard' option
1226+
" values in the 'clipboard' option, and ignores the "autoselect" value.
12271227
func Test_clipboard_provider_clipboard_option()
12281228
CheckFeature clipboard_provider
12291229

@@ -1273,6 +1273,19 @@ func Test_clipboard_provider_clipboard_option()
12731273
call assert_equal(["testing"], g:vim_copy.lines)
12741274
call assert_equal(["testing"], g:vim_copy.lines)
12751275

1276+
if has('clipboard')
1277+
" Test that autoselect option is ignored, this can happen when visual
1278+
" selection ends and there is TextYankPost autocmd
1279+
set clipboard=autoselect
1280+
let g:autoselect_test = 1
1281+
au TextYankPost * let g:autoselect_test = 0
1282+
1283+
call setline(1, "Hello world!")
1284+
call cursor(1, 0)
1285+
call feedkeys("vww\<Esc>", "x!")
1286+
call assert_equal(1, g:autoselect_test)
1287+
endif
1288+
12761289
" Change and delete operations are tested in
12771290
" Test_clipboard_provider_accessed_once()
12781291
bw!
@@ -1290,5 +1303,4 @@ func Test_clipboard_provider_clipboard_option()
12901303
set clipboard&
12911304
endfunc
12921305

1293-
12941306
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,8 @@ static char *(features[]) =
734734

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
249,
737739
/**/
738740
248,
739741
/**/

0 commit comments

Comments
 (0)