Skip to content

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
	...

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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants