Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
inukshuk opened this issue Mar 22, 2024 · 2 comments · Fixed by #705
Closed

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

inukshuk opened this issue Mar 22, 2024 · 2 comments · Fixed by #705
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@inukshuk
Copy link

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

@tompng
Copy link
Member

tompng commented Mar 22, 2024

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

@inukshuk
Copy link
Author

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

@tompng tompng added the bug Something isn't working label Mar 23, 2024
@tompng tompng added the good first issue Good for newcomers label Mar 30, 2024
monkeyWzr added a commit to monkeyWzr/reline that referenced this issue May 15, 2024
tompng pushed a commit that referenced this issue May 26, 2024
* allow space in config value

fix #657

* remove inline comments

* Revert "remove inline comments"

This reverts commit 2438347.

* refactoring

* remove unnecessary comment handling
matzbot pushed a commit to ruby/ruby that referenced this issue May 26, 2024
(ruby/reline#705)

* allow space in config value

fix ruby/reline#657

* remove inline comments

* Revert "remove inline comments"

This reverts commit ruby/reline@2438347c1a10.

* refactoring

* remove unnecessary comment handling

ruby/reline@d60f1e1e39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Development

Successfully merging a pull request may close this issue.

2 participants