Skip to content

Commit

Permalink
__fish_cursor_xterm: Ignore unknown cursor settings
Browse files Browse the repository at this point in the history
This prevents leaking the escape sequence by printing nonsense, and it
also allows disabling cursor setting by just setting the variable to
e.g. empty.

And if we ever added any shapes, it would allow them to be used on new
fish and ignored on old

Fixes #9698
  • Loading branch information
faho committed Mar 31, 2023
1 parent e78560d commit e45bddc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc_src/interactive.rst
Expand Up @@ -429,6 +429,8 @@ The ``fish_vi_cursor`` function will be used to change the cursor's shape depend

Additionally, ``blink`` can be added after each of the cursor shape parameters to set a blinking cursor in the specified shape.

Fish knows the shapes "block", "line" and "underscore", other values will be ignored.

If the cursor shape does not appear to be changing after setting the above variables, it's likely your terminal emulator does not support the capabilities necessary to do this. It may also be the case, however, that ``fish_vi_cursor`` has not detected your terminal's features correctly (for example, if you are using ``tmux``). If this is the case, you can force ``fish_vi_cursor`` to set the cursor shape by setting ``$fish_vi_force_cursor`` in ``config.fish``. You'll have to restart fish for any changes to take effect. If cursor shape setting remains broken after this, it's almost certainly an issue with your terminal emulator, and not fish.

.. _vi-mode-command:
Expand Down
3 changes: 3 additions & 0 deletions share/functions/__fish_cursor_xterm.fish
Expand Up @@ -8,6 +8,9 @@ function __fish_cursor_xterm -d 'Set cursor (xterm)'
set shape 4
case line
set shape 6
case '*'
# Unknown shape
return
end
if contains blink $argv
set shape (math $shape - 1)
Expand Down

0 comments on commit e45bddc

Please sign in to comment.