On 12/07/2024 10:56, Max Nikulin wrote:
I have a question opposite to the original one. Is it possible to
disable xon&xoff for bash prompt, but enable it while foreground
commands are running?
I do not mind to use forward search in readline history.
As to the original question, Emacs and Vim disable flow control while
they are active, so it is possible to use Control-s there without any
wrapper. Now I think that it is failure of rtorrent if it does not
manage ixon state.
Managing separate ixon state for prompt and for commands in BASH is more
tricky than I expected. Perhaps I should try to patch C code instead.
BASH saves and restores terminal state at some steps. As a result, PS1
is more suitable for calling "stty -ixon" than PROMPT_COMMAND. If the
same command is called through a key sequence ("bind -x") then state
before prompt is restored before PS0 expansion and command execution.
Frankly speaking, I infrequently regretted that C-s did not stat search.
The feature does not cost time spent in the state "it is almost working
already". Perhaps there are still cases when ixon state is switched
incorrectly.
For the case that somebody else is brave enough to try it, see
<https://gist.github.com/3c33c67c058f9091a05581dc593a58fd>
Maybe mailing list filter correctly assessed that it does not deserve to
be posted here.