1

This is my environment :

X server : VCXsrv Windows
Window manager : XFCE/WSL
bash : 5.0.0(1)-release
Environment variable TERM : xterm

When I type a command longer than the width of xterm, the line scrolls horizontally instead of wrapping the line, like

<lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll

Some online articles suggest following command :

bind 'set horizontal-scroll-mode off'

but it didn't fix the issue in my context.

What else can I try to troubleshoot ?

Update 1:

bash-5.0$ printf "%s\n" "$PS1"
\s-\v\$ 

Update 2:

/bin$ tput up
tput: unknown terminfo capability 'up'
Philippe
  • 1,275
  • 7
  • 14
  • Related questions are https://unix.stackexchange.com/q/525477/5132 and https://unix.stackexchange.com/q/529377/5132 . – JdeBP Sep 19 '20 at 10:12
  • @JdeBP, I looked at those two questions before I made the post. Apart from above `bind` command, what else can I try ? – Philippe Sep 19 '20 at 10:45
  • Have you checked the `TERM` variable? If it's wrong then `off` will not work. – Kamil Maciorowski Sep 19 '20 at 10:51
  • @KamilMaciorowski As I said in post, TERM=xterm. I tried other values as well, like `xterm-256color`, or `ansi`, `vt100`, etc. – Philippe Sep 19 '20 at 10:58
  • OK, we know it's `xterm`; but does your machine know what `xterm` *means*? – Kamil Maciorowski Sep 19 '20 at 11:06
  • @KamilMaciorowski I ran `infocmp xterm`, and got `xterm|xterm-debian|X11 terminal emulator ...` Do I need to check anything in particular in that output ? – Philippe Sep 19 '20 at 11:16
  • Probably not. Even if, I don't know what exactly. Sorry. – Kamil Maciorowski Sep 19 '20 at 11:46
  • @KamilMaciorowski Thanks anyway! My apologies for not putting the full `bind` command in the first place. – Philippe Sep 19 '20 at 12:12
  • Hummm... is the "<" seen at the beginning of the line actually standing for your prompt ? If yes, could you post the output of echo $PS1 ? – MC68020 Sep 19 '20 at 12:37
  • @MC68020 post updated. `<` is not part of the command – Philippe Sep 19 '20 at 12:48
  • When you ran `bind 'set horizontal-scroll-mode off'` did you get any message or error returned? For a `bash` shell using readline it should be the right solution, which is what's puzzling me – roaima Sep 19 '20 at 13:24
  • @roaima No messages at all following `bind` command – Philippe Sep 19 '20 at 13:26
  • @Philippe "infocmp xterm ... Do I need to check anything in particular in that output ?" Yes, look for `am` (automatic right margin) –  Sep 19 '20 at 13:35
  • @user414777 First line does contain `am` : `am, bce, km, mc5i, mir, msgr, npc, xenl,` – Philippe Sep 19 '20 at 13:50
  • It may also be that bash is unable to get the height of the terminal and decides that your terminal has a single line. That could also cause it to horiz-scroll instead of wrap. –  Sep 19 '20 at 13:58
  • @Philippe have you tried putting `set horizontal-scroll-mode off` in `~/.inputrc` and starting a new shell? – peterph Sep 19 '20 at 13:59
  • @peterph I did put `set horizontal-scroll-mode off` in ~/.inputrc and starting a new shell. – Philippe Sep 19 '20 at 14:09
  • @user414777 variables LINES=24, COLUMNS=80 are in line with `tput lines`, and `tput columns` – Philippe Sep 19 '20 at 14:11
  • Does `setterm -linewrap on` work? – Quasímodo Sep 19 '20 at 16:57
  • @Quasímodo After running `setterm`, still the same issue. – Philippe Sep 19 '20 at 17:00
  • What you should be asking the questioner to [edit] into the question is what `tput up | hexdump` yields. https://unix.stackexchange.com/a/567575/5132 – JdeBP Sep 20 '20 at 10:17
  • @JdeBP `tput up` yields `tput: unknown terminfo capability 'up'` – Philippe Sep 20 '20 at 10:44

2 Answers2

1

Finally I got 5.0.18(1)-release source from github, compiled it which fixed the problem.

Philippe
  • 1,275
  • 7
  • 14
0

I'm running Linux Mint, and Bash 4.4.20 is installed by default.

I had manually compiled and installed Bash 5.0 and ran into the OP's rendering problem.

Upgrading to Bash 5.1 solved this rendering problem for me.

jmrah
  • 101
  • 2