From: Foxe Chen Date: Thu, 29 Jan 2026 19:10:51 +0000 (+0000) Subject: patch 9.1.2114: modeless selection not copied to * register X-Git-Tag: v9.1.2114^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ac59be07128d12327e848264d5a456eb24d7dd0;p=thirdparty%2Fvim.git patch 9.1.2114: modeless selection not copied to * register Problem: modeless selection not copied to * register when P in guioptions (Coacher) Solution: Make the "P" flag override the "a" and "A" flag (Foxe Chen) fixes: #19187 closes: #19244 Signed-off-by: Foxe Chen Signed-off-by: Christian Brabandt --- diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index fb94aec4da..cdb75dae2a 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 9.1. Last change: 2026 Jan 28 +*options.txt* For Vim version 9.1. Last change: 2026 Jan 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4515,8 +4515,8 @@ A jump table for the options with a short description can be found at |Q_op|. by a yank or delete operation for the "* register. The same applies to the modeless selection. *'go-P'* - 'P' Like autoselect but using the "+ register instead of the "* - register. + 'P' Like autoselect but only copy to the "+ register instead of + the "* register. *'go-A'* 'A' Autoselect for the modeless selection. Like 'a', but only applies to the modeless selection. diff --git a/src/clipboard.c b/src/clipboard.c index 8cf62cf88b..6a0473b0ae 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -452,11 +452,12 @@ clip_auto_select(void) int clip_isautosel_star(void) { - return ( -# ifdef FEAT_GUI - gui.in_use ? (vim_strchr(p_go, GO_ASEL) != NULL) : -# endif - clip_autoselect_star); +#ifdef FEAT_GUI + if (gui.in_use) + return vim_strchr(p_go, GO_ASEL) != NULL + && vim_strchr(p_go, GO_ASELPLUS) == NULL; +#endif + return clip_autoselect_star; } /* @@ -466,11 +467,11 @@ clip_isautosel_star(void) int clip_isautosel_plus(void) { - return ( -# ifdef FEAT_GUI - gui.in_use ? (vim_strchr(p_go, GO_ASELPLUS) != NULL) : -# endif - clip_autoselect_plus); +#ifdef FEAT_GUI + if (gui.in_use) + return vim_strchr(p_go, GO_ASELPLUS) != NULL; +#endif + return clip_autoselect_plus; } diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index 3837837be7..67b0500aa6 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -1827,4 +1827,38 @@ func Test_Buffers_Menu() %bw! endfunc +" Test if 'guioptions=a' only copies to the primary selection and +" 'guioptions=aP' only copies to the regular selection. +func Test_guioptions_clipboard() + CheckX11BasedGui + + set mouse= + let save_guioptions = &guioptions + set guioptions=a + + let @+ = "" + let @* = "" + + call setline(1, ['one two three', 'four five six']) + call cursor(1, 1) + call feedkeys("\vee\", "Lx!") + + call assert_equal("one two", @*) + call assert_equal("", @+) + + set guioptions=aP + + let @+ = "" + let @* = "" + + call cursor(1, 1) + call feedkeys("\veee\", "Lx!") + + call assert_equal("one two three", @+) + call assert_equal("", @*) + + set mouse& + let &guioptions = save_guioptions +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index f79353e517..a885fd23d4 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2114, /**/ 2113, /**/