Skip to content

Cursor offset with show-mode-in-prompt string #657

Closed

Description

@inukshuk

Description

I have the following config in my .inputrc to modify the cursor shape via escape sequences in the vi-mode-string variables:

set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string \1\e[6 q\2
set vi-cmd-mode-string \1\e[2 q\2

With these escape sequences in place the IRB prompt is offset (it reads rb(main) instead of irb(main)) and cursor/caret is placed at the beginning of the line (over the 'r') instead of at the prompt. Typing inserts the correct characters at the prompt and the cursor moves but keeps the original offset.

For example, typing the command p 1 would move the cursor as indicated:

rb(main):001> 
^
rb(main):001> p
 ^
rb(main):001> p 
  ^
rb(main):001> p 1
   ^
rb(main):002>
^

Terminal Emulator

Gnome Terminal, Black Box, Alacritty, iTerm2, Gnome Console

Activity

  1. tompng commented on Mar 22, 2024

    @tompng
    Member

    Looks like a config loading bug. q\2 part is ignored, maybe because it uses .split(' ').

    Using \x20 might be a workaround

    set vi-ins-mode-string \1\e[6\x20q\2
    set vi-cmd-mode-string \1\e[2\x20q\2
    
  2. inukshuk commented on Mar 22, 2024

    @inukshuk
    Author

    @tompng good catch, thank you! Using \x20 to work around for now.

  3. added
    bug
    on Mar 23, 2024
  4. added
    good first issue
    on Mar 30, 2024
  5. added a commit that references this issue on May 15, 2024
    06a8911
  6. added a commit that references this issue on May 26, 2024
    d60f1e1
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

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions