1

I got a small issue with line wrapping on a custom linux and I'm not sure where this is set.

When on serial console or using SSH login i get the following:

Cursor at start of line

[user@myhost ~]$ dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd>

Cursor at end of line

<ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd

So instead of breaking into multiple lines it continues into described by the angle brackets.

Can anybody point me into the direction where I can change this behaviour? Tried messing with inputrc for readline and something like "set horizontal-scroll-mode" but I'm not sure that this is the right place

LarsP
  • 11
  • What is your shell? – glenn jackman Jul 10 '19 at 13:28
  • Currently its sh but I have also tried bash – LarsP Jul 10 '19 at 19:22
  • "When no serial console and SSH login i get the following" – so where exactly do you get this behavior? "and something like «set horizontal-scroll-mode»" – what have you tried exactly that you assumed based on other docs that would work but didn't? – egmont Jul 10 '19 at 20:03

1 Answers1

4

If your shell is bash, try

bind 'set horizontal-scroll-mode off'

and if that fixes it, add a set horizontal-scroll-mode off line to your ~/.inputrc file.

Also, check if there's an entry in the terminfo database for the terminal from the TERM variable by running infocmp. If readline (as used by bash) is not able to find an entry for it, it will fall back to horizontal-scroll-mode (since it cannot assume that the terminal has automatic margins).

You can always export a terminfo definition from one machine to another with:

infocmp termname | ssh user@host tic -

That will create a per-user entry inside ~/.terminfo/. If you omit termname, infocmp value will use the content of TERM.


That's also the behavior of the mksh (the default shell on Android) and of OpenBSD's ksh (with the difference that the < is on the right side). For that case, I don't think that it's possible to configure it away.

  • Changing this value worked for serial console but by SSH login the horizontal-scroll-mode doesn't seem to do anything. Instead I tried changing the TERM from xterm-256color to TERM=xterm and it changed into the correct line wrapping behavior. – LarsP Jul 11 '19 at 10:57
  • 2
    Probably the terminfo definition file for xterm-256color is missing. – egmont Jul 11 '19 at 11:47
  • @LarsP yes, that probably means that bash isn't able to find the terminfo entry for xterm-256color, see updated answer. It's not ssh vs serial line which makes a difference. –  Jul 11 '19 at 13:49
  • @egmont that's certainly the case; running TERM=blabla bash also causes it to fall back to horiz scroll, and the differences between xterm and xterm-256color cannot account for it. –  Jul 11 '19 at 13:52
  • When I set this in my ~/.inputrc it would print out set horizontal-scroll-mode off on the command line every time I typed b. I had to use 'set horizontal-scroll-mode off' without the bind or quotes instead to get this to work. – User123456 Mar 22 '21 at 19:30