GNU screen scrolling #4685
avengerx
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using an old play store release of Termux (not the "unofficial one"), but I believe this will still apply for new releases (GitHub or F-Droid ones), so sharing it here.
I am using termux to access a home computer via ssh and use an "oldschool" automation script (those that we assign a key to an action, and
read
the key in the terminal).As the target computer is in a weak wifi spot, it often disconnects and I have to go back to the session etc. So if it is doing a long operation it might just kill it as the terminal "vanished" when the SSH connection realizes it was cut. The solution for that was to use a screen session, so that I can go out and back in the "terminal" when a connection reset occurs, without interrupting anything.
Problem solved, problem found. The problem then is that
screen
, in its default settings, has its own buffer and scrolling mechanism (ctrl+a, <esc>
, "copy mode", one of the ways to navigate thru scroll buffer). And if I try to scroll with termux, it just sends a very long sequence of (sorry I don't remember exactly)]A]D]A]J]Y]K
and, as the terminal is reading every key (read -n1
), it processes the input for every single one and it can fall in an option or just refresh, refresh and refresh again the current menu, complaining of invalid input.While searching for a way to make
screen
(the GNU screen tool) work, I stumbled in this stackoverflow thread: scroll inside screen or pause output. It is not quite about the problem I had, but one of the solutions worked! It suggested the following~/.screenrc
:And voila! After I restarted the screen session and filled the buffer enough to get some scrolling, the TermUX scroll in the phone worked like a charm!
It also worked with the PuTTY client I use in Windows to access the same computer, so it was a double-nice, and I will no longer get flooded by accidentally scrolling around or have to go to the painful copy mode if I wanted to check something outside the viewport.
I hope this helps other people using termux with the GNU screen tool!
Notice: The
screen
tool is run in the remote Windows terminal (using cygwin+sshd), it is not installed in TermUX. All TermUX is doing here is emulating the terminal window and running SSH client software. The~/.screenrc
then is created in the remote machine, not the Android phone. It's just telling screen how it should handle client terminals labeled afterxterm
like TermUX (at least my version, I don't remember setting anything to force it to export "Xterm" as the terminal type). It ended up woking well with Windows' PuTTY as well. And probably any xterm-compatible terminal emulator.Beta Was this translation helpful? Give feedback.
All reactions