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 <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Foxe Chen
2026-01-29 19:10:51 +00:00
committed by Christian Brabandt
parent b817536b8f
commit 0ac59be071
4 changed files with 50 additions and 13 deletions
+3 -3
View File
@@ -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.
+11 -10
View File
@@ -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;
}
+34
View File
@@ -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("\<Esc>vee\<Esc>", "Lx!")
call assert_equal("one two", @*)
call assert_equal("", @+)
set guioptions=aP
let @+ = ""
let @* = ""
call cursor(1, 1)
call feedkeys("\<Esc>veee\<Esc>", "Lx!")
call assert_equal("one two three", @+)
call assert_equal("", @*)
set mouse&
let &guioptions = save_guioptions
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2114,
/**/
2113,
/**/