Ed Rogers
Ed Rogers

Reputation: 85

Emulate a taller terminal within GNOME Terminal and pan up and down

The problem:

I need to be able to run TUI programs that do no fit in a 9-line high terminal inside a nine-line terminal by panning up and down.

The set-up:

I have a Raspian computer connected to a 9-line Braille display (Canute 360). The Braille is automatically sent the last 9 lines of the terminal by screenreader software called brltty. The terminal emulator is gnome-terminal which is pre-set to 9 lines by 40 characters.

I am coming across TUI programs that we need to run (such as raspi-config) that assume the terminal will be more than 9 lines high and therefore do not work as certain options are hidden off the top of the terminal window. This means they are invisible on the Canute Braille display.

I cannot edit or change the size of the gnome-terminal (it needs to stay as-is to meet the client specification). I can't change brltty's behaviour as that is an external program, or the Braille display's behaviour. I can install any program within Raspian, but I cannot realistically patch and fix every TUI application with this behaviour, I need a fix that can be applied any time a user comes across a problem.

Using raspi-conf as the test case:

It assumes at least 12-line terminal but currently only the bottom 9 lines are visible, cutting off critical options from view (on the monitor and on the Braille display). If I can run a command or create a script that lets the user pan up and down, perhaps by running a taller terminal instance inside the 9-line one, then using keyboard short cuts to scroll up and down, then I assume I have solved the issue for all similar TUI applications.

Tried:

Upvotes: 3

Views: 116

Answers (1)

pynexj
pynexj

Reputation: 20797

I tried with GNU screen in a 40x9 iTerm window on macOS (also tried with PuTYY on Windows) and the following "works" for me.

  • Start a screen session. In the shell prompt, echo $LINES $COLUMNS (or stty size) outputs 9 40.

  • At this time, long lines would be wrapped at column 40 as usual. See this ls -l / output:

      enter image description here  

  • Press C-a : and run screen command width -w 80.

  • Press C-a : and run screen command height -w 24.

  • Now echo $LINES $COLUMNS would output 24 80 and the earlier ls -l / output is re-wrapped at 80 column. Since the "phyiscal" window is 40 columns you need to press C-a [ to enter copy mode and then use direction keys to move around.

      enter image description here  

  • Now I start vim and only the top-left part is visible.

      enter image description here  

  • To see other part of the vim window, I press C-a [ to enter copy mode and then I can move around. The following is when I moved to the bottom-left corner to see vim's status line.

      enter image description here


So for your TUI app, if some input area or buttons are not visible you can also do the similar things:

  • Enter copy mode (C-a [)
  • Move to where you need to input something
  • Exit copy mode (Esc)
  • Input data

Upvotes: 3

Related Questions