[vim/vim] hlyank does not handle GUI autoselect via 'guioptions' P (Issue #20792)

10 views
Skip to first unread message

arkissa

unread,
Jul 19, 2026, 9:47:23 AM (3 days ago) Jul 19
to vim/vim, Subscribed
Arkissa created an issue (vim/vim#20792)

Steps to reproduce

hlyank have guard for clipboard of autoselect with star register.

    # if clipboard has autoselect (default on linux) exiting from Visual with
    # ESC generates bogus event and this highlights previous yank
    if &clipboard =~ 'autoselect' && v:event.regname == "*" && v:event.visual
      return
    endif

but omitte the 'guioptions' P.

	  'P'	Like autoselect but only copy to the "+ register instead of
		the "* register.

when set guioptions+=P hlyank whill be got odd. like this video

https://github.com/user-attachments/assets/e5a01cf5-8d22-4513-ab4a-a14b1e7289e5

because when set guioptions+=P autoselect will be to use '+' regiser, that can be bypass hlyank guard.

Expected behaviour

not hightlight on autoselect.

Version of Vim

9.2.803

Environment

Linux debian 7.1.3+deb14-amd64 #1 SMP PREEMPT_DYNAMIC Debian 7.1.3-1 (2026-07-04) x86_64 GNU/Linux
gvim and kitty 0.47.4
xterm-kitty
bash 5.3.9

Logs and stack traces

N/A


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792@github.com>

Foxe Chen

unread,
Jul 19, 2026, 2:54:48 PM (2 days ago) Jul 19
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#20792)

Would the solution be to check for the 'P' flag in 'guioptions' in the guard?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792/5016970901@github.com>

arkissa

unread,
Jul 19, 2026, 10:26:49 PM (2 days ago) Jul 19
to vim/vim, Subscribed
Arkissa left a comment (vim/vim#20792)

Would the solution be to check for the 'P' flag in 'guioptions' in the guard?解决办法是不是在守护的“guioptions”里检查'P'标志?

Maybe? but if we check them in the guard, we won't be able to use the hlyank plugin.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792/5018222709@github.com>

Foxe Chen

unread,
Jul 19, 2026, 10:54:29 PM (2 days ago) Jul 19
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#20792)

Would the solution be to check for the 'P' flag in 'guioptions' in the guard?解决办法是不是在守护的“guioptions”里检查'P'标志?

Maybe? but if we check them in the guard, we won't be able to use the hlyank plugin.

Would this maybe work (added below the existing guard):

if &clipboard =~ 'P' && has('gui_running') && v:event.regname == "*" && v:event.visual
  return
endif


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792/5018324004@github.com>

arkissa

unread,
Jul 19, 2026, 11:17:27 PM (2 days ago) Jul 19
to vim/vim, Subscribed
Arkissa left a comment (vim/vim#20792)

Would this maybe work (added below the existing guard):这样或许可行(添加在现有守卫之后):

if &clipboard =~ 'P' && has('gui_running') && v:event.regname == "*" && v:event.visual
return
endif

'P' is not in the &clipboard.

https://github.com/user-attachments/assets/6d9e80f2-01e6-4182-9452-2c58565f08a8

You might want to say this?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792/5018441103@github.com>

Foxe Chen

unread,
Jul 19, 2026, 11:18:34 PM (2 days ago) Jul 19
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#20792)

Would this maybe work (added below the existing guard):这样或许可行(添加在现有守卫之后):

if &clipboard =~ 'P' && has('gui_running') && v:event.regname == "*" && v:event.visual
return
endif

'P' is not in the &clipboard.

2026-07-20.11-09-14.mp4


You might want to say this?

if &guioptions =~ 'P' && has('gui_running') && v:event.regname == "*" && v:event.visual
return
endif

Yes


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792/5018446678@github.com>

arkissa

unread,
Jul 20, 2026, 12:04:33 AM (yesterday) Jul 20
to vim/vim, Subscribed
Arkissa left a comment (vim/vim#20792)

the code can work, just no have anything highlight on selection region if set guioptions+=P.

if &guioptions =~ 'P' && has('gui_running') && v:event.regname == "+" && v:event.visual
  return
endif

However, I think the underlying reason for this problem is that Vim doesn't update the visual block created by the mouse kselected text to the '['] mark.

https://github.com/user-attachments/assets/43583139-5d03-493e-903a-c1ded5273ef5


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792/5018650530@github.com>

Foxe Chen

unread,
9:18 AM (13 hours ago) 9:18 AM
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#20792)

However, I think the underlying reason for this problem is that Vim doesn't update the visual block created by the mouse kselected text to the '['] mark.

That sounds like a different issue.
So is this issue fixed using that code?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792/5034529119@github.com>

arkissa

unread,
8:47 PM (2 hours ago) 8:47 PM
to vim/vim, Subscribed
Arkissa left a comment (vim/vim#20792)

That sounds like a different issue. So is this issue fixed using that code?

This feels more like a temp fix, and I’m not sure it’s the best way to go. I’m still on the fence.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20792/5040567032@github.com>

Reply all
Reply to author
Forward
0 new messages