Skip to content

[RFC] Multiple cursors #8927

Description

@kovidgoyal

Hi all,

I have just implemented support for multiple cursors in kitty using a new escape code protocol. Multiple cursors are used in many editor programs to allow the user to make the same change at multiple points in the file. Currently these are often implemented using a hack involving a Unicode solid block character or similar. I felt it would be nice to let TUI editors display native correctly rendered multiple cursors.

To try it out install a nightly build or build kitty from source. Then, you can show multiple cursors with:

# Show cursors of the same shape as the main cursor at y=4, x=5
printf "\e[>29;2:4:5 q"
# Show more cursors on the seventh line, of various shapes, the underline shape is shown twice
printf "\e[>1;2:7:1 q\e[>2;2:7:3 q\e[>3;2:7:5;2:7:7 q"
# Clear the cursors
printf "\e[>0:4 q"

The specification of the protocol and description of its semantics is in
multiple-cursors-protocol.rst

If anyone knows of any conflicts with existing usage of the escape code (which is based on the existing DECSCUSR escape code, with the addition of > do let me know, I can change it easily, if needed.

Also if people looking to implement it have any concerns on its semantics or design, now is the time to suggest changes.

Thanks.

Pinging a few people that might be interested, apologies for the noise:
@rockorager @neurocyte @dankamongmen @justinmk @the-mikedavis @mawww

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions