Skip to content

Cursor Color and Style changes #352

@Shoozza

Description

@Shoozza

MinTTY allows to change cursor styles and colors but mosh ignores them.
This would be useful for vim (different insert and normal mode cursors)

Mode-dependent cursor in vim:
CSI Ps SP q

Example: echo -ne '\e]12;#00FF00\a' # green cursor
http://code.google.com/p/mintty/wiki/Tips#Mode-dependent_cursor_in_vim

Changing colors:
OSC Ps ; Pt ST
OSC Ps ; Pt BEL

Example: echo -ne "\e[2 q" # non blinking block cursor
http://code.google.com/p/mintty/wiki/Tips#Changing_colours


Xterm Control Sequences taken from
http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt

Activity

theeternalsw0rd

theeternalsw0rd commented on Jan 22, 2013

@theeternalsw0rd

Not just mintty. This is across the board. Mosh currently only looks for visibility and position of the cursor.

The spec is at http://vt100.net/docs/vt510-rm/DECSCUSR

theeternalsw0rd

theeternalsw0rd commented on Jan 27, 2013

@theeternalsw0rd

There's also another sequence used by iTerm2 and Konsole https://code.google.com/p/iterm2/issues/detail?id=710
among others documented at http://vim.wikia.com/wiki/Change_cursor_shape_in_different_modes

In addition with tmux running, the codes must be further escaped by "\ePtmux;\e" and "\e"

To make matters worse, when using tmux if you have a remote tmux session within a local tmux session, you have to send multiple codes so that it will update on multiple ends. In my case I use Konsole on linux and iTerm2 on OSX and still have to send the xterm-based sequence to get tmux within tmux to display the correct cursor even though both ends should support the same sequence.

ssh works fine because it sends the full stream both ways, but with mosh's diff based system I'm not sure how feasible monitoring all this would be because I don't think it's something that can be queried, at least not across the board, and even if it can be queried, which code should it use and on which end.

Why cursor shape definition isn't a followed standard is beyond me. Makes portability extremely difficult.

ddickstein

ddickstein commented on Feb 13, 2017

@ddickstein

+1 on this issue

msva

msva commented on Feb 2, 2018

@msva

is it any work in this direction? :D

xPMo

xPMo commented on Mar 27, 2018

@xPMo

Re: Tmux: Adding set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q' to .tmux.conf is the way to allow tmux to pass cursor codes. Mosh still needs to support it, ofc.

broander

broander commented on Aug 22, 2020

@broander

Cursor change should be possible, unlike a lot of the other open feature requests it won't add a lot of data overhead. Seems like the problem is there have been no new releases in years?

kovasap

kovasap commented on Jan 22, 2021

@kovasap

+1 on this issue!

NightMachinery

NightMachinery commented on Oct 6, 2021

@NightMachinery

This also works on Kitty. It would be great to support it.

printf '\x1b]12;%s\a' '#ffffe4e4c4c4'
added this to the mosh-1.5.0 milestone on Jan 20, 2023
achernya

achernya commented on Jan 20, 2023

@achernya
Collaborator

It looks like this was supported in xterm per https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

redone9211

redone9211 commented on Jan 22, 2023

@redone9211

i would like to contribute to this issue , can you let me know how i can solve it.

achernya

achernya commented on Jan 24, 2023

@achernya
Collaborator

PR #1167 from Issue #1084 is a (partial?) solution to this.

oscarmlage

oscarmlage commented on Feb 28, 2024

@oscarmlage

Any news or progress on this issue?

i18nsite

i18nsite commented on Nov 13, 2024

@i18nsite

please merge #1292

It will be fine after I apply this patch

martijnkruiten

martijnkruiten commented on Nov 13, 2024

@martijnkruiten

I've been using the changes from #1292 daily for quite a while and I haven't noticed any issues with it. It works as advertised.

msva

msva commented on Nov 14, 2024

@msva

// just in case anybody interested, I merged #1292 and some other PRs form here in https://github.com/alphallc/mosh
Also, I've made Ubuntu PPA with mosh build from that fork at ppa:mva/mosh (https://launchpad.net/~mva/+archive/ubuntu/mosh)

uqs

uqs commented on Apr 2, 2025

@uqs

As someone who has just learned about this and now uses this in zshrc to get pipe or block cursors, the lack of support in Mosh is sad. All other ssh, xterm, vim, tmux combinations work, only mosh is missing.

Any idea when this will get merged? What sort of testing would you like to see?

oscarmlage

oscarmlage commented on Apr 3, 2025

@oscarmlage

Yes,please merge #1292

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @oscarmlage@uqs@msva@Shoozza@theeternalsw0rd

        Issue actions

          Cursor Color and Style changes · Issue #352 · mobile-shell/mosh