elves / elvish

Powerful scripting language & versatile interactive shell
https://elv.sh/
BSD 2-Clause "Simplified" License
5.67k stars 300 forks source link

Can't bind some keys (c-q/c-s) when using elvish as default shell #1488

Closed aca closed 2 years ago

aca commented 2 years ago
terminal: Alacritty / wezterm
os: Linux rok-te3 5.16.2-arch1-1 #1 SMP PREEMPT Thu, 20 Jan 2022 16:18:29 +0000 x86_64 GNU/Linux

I'm not sure it is issue of elvish. But I'm experiencing something wierd. Any help would be appreciated..

set edit:insert:binding[Ctrl-Q] = { exit }
set edit:insert:binding[Ctrl-S] = { exit }

These bindings just doesn't work if I set it to default shell in terminal emulator configuration for alacritty/wezterm. But it works fine if I start elvish after starting fish shell.

elv$  # not work
elv$ fish
fish$ elvish
elv$  # work

image

Can't type c-q at first..

aca commented 2 years ago

This is because fish disables terminal control flow. Setting stty -ixon fixes the problem.

krader1961 commented 2 years ago

FWIW, I was contributing to the Fish shell project when the change to the handling of Ctrl-S and Ctrl-Q (tty software flow control) was made. It was a controversial change. There were arguments that the shell should not unilaterally disable software flow control. Others argued that the concept of software flow control was obsolete and disabling the feature was useful since it allowed binding those two key sequences to useful functions. Obviously the latter argument won.

I am a grey beard who used UNIX when RS-232 and dial-up connections using a terminal like a DEC VT-100 was the most common way to interact with UNIX systems. Software flow control in the 1980's and 1990's was extremely useful. That is no longer true. I believe Elvish should unilaterally disable software flow control on UNIX systems. But this begs a larger question of whether Elvish should run external commands with its preferred tty configuration or the tty configuration it was given. Similarly, how to incorporate changes to its tty configuration when an external command terminates.

aca commented 2 years ago

@krader1961 It's always great to see your experienced, thoughtful comment.