PTerm icon indicating copy to clipboard operation
PTerm copied to clipboard

Function keys are not supported

Open Rinzwind opened this issue 2 years ago • 2 comments

Function keys are not yet supported in PTerm. Some applications that use them are GNU Midnight Commander and htop.

Rinzwind avatar Oct 22 '23 21:10 Rinzwind

While trying to implement support for function keys, I encountered a slight problem: TerminalEmulatorXterm nominally mimics xterm, but TerminalEmulator’s #environ actually sets the ‘TERM’ environment variable to ‘linux’, and these two terminals use different sequences for some of the function keys. The sequences for each can be gotten from ‘tput’ through the following snippet:

#(xterm linux)
	collect: [ :type |
		type -> ((1 to: 24)
			collect: [ :n |
				(KeyboardKey named: ('F{1}' format: { n })) ->
					(LibC resultOfCommand: ('tput -T {1} kf{2}' format: { type. n })) ]
			as: OrderedDictionary) ]
	as: OrderedDictionary

Rinzwind avatar Oct 22 '23 21:10 Rinzwind

Yes i remember settting TERM to linux for some reason (can't recall which one though, probably something related to the themes).

We could change it to xterm or xterm-256color, but need to check for any side effects

lxsang avatar Oct 23 '23 08:10 lxsang