Re: mouse to move the cursor?

Oliver Kiddle <[email protected]> Wed, 11 Feb 2026 00:06:35 +0100
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <[email protected]>
Bart Schaefer wrote:
> This is a terminal-emulator thing rather than a zsh thing,  If your
> terminal can translate the mouse-click into the correct
> cursor-relative movement and send it to the terminal, the cursor will
> move.

The OSC 133 prompt integration sequence that zsh built from latest
sources can generate does facilitate this with some terminals. It even
works in kitty.

The sequence tells the terminal where prompts start and end and they can
use this in a variety of ways. There are some options, currently it uses
cl=m which kitty takes to mean it should fake cursor movements in
response to mouse clicks.

There is wide support for enabling mouse reporting for the terminal as
a whole but it tends to break other things like the scroll-wheel or
selecting and copying text.

With OSC 133, there is an option to report mouse click positions within
the prompt. To try it, use the following in kitty, enter some text and
click in the line:

    printf '\033]133;A;click_events=1\033\\'; read line

This would be better than faked cursor movements. Translating cursor
positions to points in the command-line buffer is not entirely trivial,
however.

Oliver