1

The context

We have a 9-line Braille display (Canute 360) which is exactly emulating the visual output of a terminal window. Both the Braille display and the gnome-terminal window are 40 characters wide and 9 lines long so the Braille display should be able to exactly mimic^1 the visual terminal window.

You should not need to understand Braille displays or BRLTTY to help with this query. I am looking for a solution in the shell and will try to explain the screen-reader part as well as possible.

^1: (Exactly mimic when using a one-to-one Braille conversion table.)

The problem

In the gnome-terminal, when a line goes over 40 characters is wraps to the next line. BRLTTY doesn't know it has wrapped and so that line overflows off the edge of the display and is either cut off or the whole display pans over.

This command:

$ echo "12345678901234567890123456789012345678901234567890"

Renders like this on the gnome-terminal:

$ echo "12345678901234567890123456789012
345678901234567890"
1234567890123456789012345678901234567890
1234567890
$

But like this on the Braille display:

$ echo "12345678901234567890123456789012
1234567890123456789012345678901234567890
$

Evidently the wrapped line is actually all one line as BRLTTY sees it. The wrapping is presentational.

What is the intended outcome?

A way of actually hard wrapping those lines so that the Braille output looks like this:

$ echo "12345678901234567890123456789012
345678901234567890"
1234567890123456789012345678901234567890
1234567890
$

... without editing BRLTTY. I am looking for a solution that works with the current expected behaviour of BRLTTY.

Alternative, less desirable but workable outcome

Stopping the lines from wrapping in gnome-terminal, so the visual gnome-terminal looks like this:

$ echo "12345678901234567890123456789012
1234567890123456789012345678901234567890
$

For the applications I am working on I can work with that if that is the simpler solution.

What I've tried

Screen or shell within a shell

I thought running screen might work because the shell within a shell would hard wrap the lines and BRLTTY would therefore read them as separate lines, but it makes no difference.

Running screen as a very wide shell within a shell did work to a degree, but then certain applications don't know to wrap at 40 characters. Currently applications like less, micro, pico, mc work fine on both the Braille display and the visual terminal. That would break if we make it very wide.

I tried sshing into a server to see if that would give hard line breaks but it didn't.

However I wonder if this approach might have legs, if I understood better how the shell and terminal work together.

Horizontal-scroll-mode

I've tried changing set horizontal-scroll-mode on in /etc/inputrc and that changes the prompt line to behave like the alternative, less desirable approach as above. However it doesn't change how the printed lines display.

Thoughts

  • I am open to trying different shells/terminal emulators.
4
  • 2
    Do you try to use stty columns 40 command ? Commented Nov 17, 2023 at 20:18
  • 1
    stty seems like a good place to start. Also be aware that most terminal emulators set values for env-vars $LINES and $COLUMNS. These may help you manage your interface. Commented Nov 18, 2023 at 4:45
  • 1
    You might want to make explicit what you mean by "shell within a shell". Put some code/commands that you have executed, so readers can duplicate your steps. Good luck. Commented Nov 18, 2023 at 4:49
  • 1
    Note that gnome-terminal has very few watchers. You'll get more eyes on your problem by naming a particular shell with a tag. (bash? or ??) . If you can add some shell within a shell sample code as mentioned above, I'll post a bounty on your question. Good luck. Commented Nov 20, 2023 at 17:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.