Blink: [Feature Request] Add suport for bar shaped cursor

Created on 26 Mar 2020  Â·  6Comments  Â·  Source: blinksh/blink

So this is feature isn't important at all but I just started using Blink recently and it is totally awesome. I use neovim and emacs (evil mode), and I miss a bit having the cursor turn into a bar/beam when in insert mode instead of the box shape.

I've been looking around and saw somewhere that Blink used Chromium's hterm (please dismiss what follows if that's not the case). It may be that Blink already supports the bar shaped cursor and it's just that terminal programs fail to find the right escape sequence. I've seen that hterm uses these escape sequences https://chromium.googlesource.com/apps/libapps/+/a5fb83c190aa9d74f4a9bca233dac6be2664e9e9/hterm/doc/ControlSequences.md#osc. ESC]50;CursorShape=[0|1|2]\a specifically should do the trick, so again, it looks like it may already be supported. Konsole terminal uses this same sequence, with 1 being the bar shape. I've tried using the sequence without success. Not sure if it's me doing something wrong but I always get the box cursor (maybe one of them makes it blink but I have that disabled, although nice feature thanks for that!).

Assuming it's not me being stupid (and it may very well be), is this something that could be implemented? Or if it's already supported, could I get some guidance on how to use it?
Thanks!

All 6 comments

Hi @xlacasa, i'm glad you like Blink.

We support cursor shapes |, _, and box. But it working only via ssh. Mosh doesn't support cursor shapes yet.

Hi @yury, do you have a hint on how a ‘|’ shaped cursor can be set?

Ooooh good to know. I'll do without the shapes then, using Mosh makes up for it.
Thank you for the fast reply @yury

@mpepping if you are ok with setting it on the remote machine, the escape sequence \e[5 q does it (replace the 5 for a 6 to have a non blinking bar).

Changing it for bash, for example: when you have ssh'd into a machine, running printf "\e[5 q" in bash will change the terminal cursor to a blinking bar. If you put that line in your .bashrc, it will do it automatically when you login. The bar cursor shape will be kept for that Blink tab after you close the ssh connection, which is a bit weird but could be worse.

It's probably not be the best way to do it but might be worth a try while you wait for a response.

EDIT: I just realised any change on the cursor (like using neovim in normal mode, which will make the cursor box shaped) will overwrite that. Setting it in the PS1 environment variable does work though, as it applies the change every time you get a new prompt line. Putting this in .bashrc PS1="$PS1\e[5 q" works for me.

@xlacasa cool, that works exceptionally well. Thank you for that!

Closing as this depends on Mosh itself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zaptrem picture zaptrem  Â·  4Comments

proportional picture proportional  Â·  3Comments

s8m2s picture s8m2s  Â·  5Comments

basepi picture basepi  Â·  5Comments

muammar picture muammar  Â·  3Comments