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

Add more fallbacks when terminfo or fiddle is not available #722

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Jun 10, 2024

Add xterm key bindings to comprehensive list. Add fallback escape sequence of cursor hide/show.
Reline works perfectly in xterm without fiddle and terminfo.

Add xterm kpp knp kdch1(kdch1 was already added) to comprehensive list because I think it is the most major ENV['TERM'] value.

Add cursor show/hide escape sequence fallback "\e[?25h" and "\e[?25l".
"\e[?#{number}#{enable ? 'h' : 'l'}" (Terminal private modes set and rest, DECSET DECRST) is a commonly used escape sequence. Even if terminal emulator does not recognize it, it will be just ignored. Note that GNU Readline always outputs DECSET of bracketed paste "\e[?2004h" even if TERM=dumb.

The value is slightly different from infocmp xterm. But I think simple one (just reset extension number 25 = cursor visibility) is safer on non-xterm environment.

$ infocmp xterm
#	Reconstructed via infocmp from file: /Applications/iTerm.app/Contents/Resources/terminfo/78/xterm
xterm|X11 terminal emulator,
	...
	civis=\E[?25l
	cnorm=\E[?12l\E[?25h
	cvvis=\E[?12;25h
	...

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Add xterm key bindings to comprehensive list
Add fallback escape sequence of cursor hide/show
Copy link
Member

@ima1zumi ima1zumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ima1zumi ima1zumi merged commit e3c73bb into ruby:master Jun 10, 2024
40 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Jun 10, 2024
(ruby/reline#722)

Add xterm key bindings to comprehensive list
Add fallback escape sequence of cursor hide/show

ruby/reline@e3c73bbe26
@tompng tompng deleted the escape_sequence_without_fiddle branch June 10, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants