[Solved] Bash doesn't wrap command lines with certern TERMs
[Solved] Bash doesn't wrap command lines with certern TERMs
If a command line is longer than the width of the terminal screen, bash should wrap the command and let the user input in the next line. It is also what bash does if the TERM environment variable is xterm.
But if TERM is set to xterm-256color, bash will not be able to wrap long command lines. It will shift the command left in the current line, copy the shifted current line to the next line and let the user input in the next line.
In GNU screen or tmux (in which TERM should be set to screen or screen-256color), bash shifts the command left in the current line and let the user input in the same line.
I also use openSUSE and bash wraps the command to the next line in the situation above.
Porteus version: Porteus-v1.1-i486 without any changes or modules
But if TERM is set to xterm-256color, bash will not be able to wrap long command lines. It will shift the command left in the current line, copy the shifted current line to the next line and let the user input in the next line.
In GNU screen or tmux (in which TERM should be set to screen or screen-256color), bash shifts the command left in the current line and let the user input in the same line.
I also use openSUSE and bash wraps the command to the next line in the situation above.
Porteus version: Porteus-v1.1-i486 without any changes or modules
Last edited by dafan on 18 Mar 2012, 14:07, edited 2 times in total.
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: Bash doesn't wrap long command lines with certern TERMs
hello dafan,
looks like a 'PS1=' variable issue. please change this variable as follows
for /etc/profile:
for /home/guest/.bashrc:
and for /root/.bashrc (can't remember if it's set up here - if you wont find it then just skip):
let me know if that resolves wrapping issue (i'm at work now so can't check myself).
looks like a 'PS1=' variable issue. please change this variable as follows
for /etc/profile:
Code: Select all
PS1="\[\e[1;31m\]\u@\h:\[\e[1;32m\]\w\$ \[\e[0m\]"
Code: Select all
PS1='\[\e[1;36m\]\u@\h:\[\e[1;32m\]\w\$ \[\e[0m\]"
Code: Select all
PS1="\[\e[1;31m\]\u@\h:\[\e[1;32m\]\w\$ \[\e[0m\]"
Please add [Solved] to your thread title if the solution was found.
Re: Bash doesn't wrap long command lines with certern TERMs
Hello fanthom
It doesn't seem to be a PS1 issue. It is the same if I set PS1 to what you wrote. It is the same even if I simply set PS1 to '$'.
It doesn't seem to be a PS1 issue. It is the same if I set PS1 to what you wrote. It is the same even if I simply set PS1 to '$'.
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: Bash doesn't wrap long command lines with certern TERMs
bad news - i have tried Kongoni and Salix Live (both based on Slackware-13.37) and the issue persist: wrapping stops working once you switch to 256 color terminal.
looks like an upstream Slackware bug.
This Thursday i'll try to update xterm package and see if that helps.
looks like an upstream Slackware bug.
This Thursday i'll try to update xterm package and see if that helps.
Please add [Solved] to your thread title if the solution was found.
Re: Bash doesn't wrap long command lines with certern TERMs
Thanks
btw. I am still using the old Porteus-v09 and the problem was already there.
btw. I am still using the old Porteus-v09 and the problem was already there.
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: Bash doesn't wrap long command lines with certern TERMs
@dafan
yep - i have checked slax-6.1.2 and same issue there.
i have read in few places that changing TERM variable is generally not a good idea:
click
click
click
maybe that's why it's not allowed in Slackware? but why other distros (gentoo, ubuntu, opensuse) accepts this variable?
unfortunately i dont know the answer.
other idea: maybe you could enable 256 color support as per application? please check out this source:
http://www.robmeerman.co.uk/unix/256colours
yep - i have checked slax-6.1.2 and same issue there.
i have read in few places that changing TERM variable is generally not a good idea:
click
click
click
maybe that's why it's not allowed in Slackware? but why other distros (gentoo, ubuntu, opensuse) accepts this variable?
unfortunately i dont know the answer.
other idea: maybe you could enable 256 color support as per application? please check out this source:
http://www.robmeerman.co.uk/unix/256colours
Please add [Solved] to your thread title if the solution was found.
Re: Bash doesn't wrap long command lines with certern TERMs
The 256 color is not the main problem. The problem is that bash will not wrap lines if TERM is set to "screen" which must be done in GNU screen or tmux.
If TERM is set to xterm in tmux or GNU screen, some ncurses software will not be drawed properly. You can download tmux and libevent from http://tmux.sourceforge.net and http://libevent.org, compile, install them and run tmux, then set TERM to xterm and run make menuconfig in the linux kernel source tree. You will understand what I mean. (Sorry. I can not upload a picture, so you must do it yourself )
So the problem is: For the people who use tmux or GNU screen, either the ncurses software is drawed improperly or bash will not wrap long command lines.
If TERM is set to xterm in tmux or GNU screen, some ncurses software will not be drawed properly. You can download tmux and libevent from http://tmux.sourceforge.net and http://libevent.org, compile, install them and run tmux, then set TERM to xterm and run make menuconfig in the linux kernel source tree. You will understand what I mean. (Sorry. I can not upload a picture, so you must do it yourself )
So the problem is: For the people who use tmux or GNU screen, either the ncurses software is drawed improperly or bash will not wrap long command lines.
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: Bash doesn't wrap long command lines with certern TERMs
i'm able to recreate the issue with tmux but screen is working just fine for me (tested also in v09)
in case of switching to root from normal user account i had to use 'su -p' when inside screen session.
screen is the only solution for now i'm afraid.
in case of switching to root from normal user account i had to use 'su -p' when inside screen session.
screen is the only solution for now i'm afraid.
Please add [Solved] to your thread title if the solution was found.
Re: Bash doesn't wrap long command lines with certern TERMs
Really? Are you sure that you have set TERM to xterm in screen?
In my Porteus-v09 the background can not be drawed in screen if TERM is xterm. There was no .screenrc file as I tested.
Btw. the ncurses Problem also appers in my openSUSE mashine, both in screen and in tmux.
In my Porteus-v09 the background can not be drawed in screen if TERM is xterm. There was no .screenrc file as I tested.
Btw. the ncurses Problem also appers in my openSUSE mashine, both in screen and in tmux.
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: Bash doesn't wrap long command lines with certern TERMs
@dafan
i was working on default "TERM=screen" inside screen session and everything was ok: wrapping and ncurses applications.
i was working on default "TERM=screen" inside screen session and everything was ok: wrapping and ncurses applications.
Please add [Solved] to your thread title if the solution was found.
Re: Bash doesn't wrap long command lines with certern TERMs
give this a try
this will show what is set
this is the command syntax to edit values
shopt -s optionNameHere
we want to set this for the line wrapping
and if you want to unset something like this
now to make changes stick add them to /root/.bashrc
like this
now run to see the changes
how about a little fun ?
add this to /root/.bashrc
let me know if that helped
Joe
this will show what is set
Code: Select all
shopt
shopt -s optionNameHere
we want to set this for the line wrapping
Code: Select all
shopt -s checkwinsize
Code: Select all
shopt -u checkwinsize
like this
# Setup color scheme <brokenman> for list call
alias ll='/bin/ls --color=auto -lF'
alias la='/bin/ls --color=auto -axF'
alias ls='/bin/ls --color=auto -xF'
# Append any additional sh scripts found in /etc/profile.d/:
for y in /etc/profile.d/*.sh ; do [ -x $y ] && . $y; done
unset y
# Setup shell prompt for root <wread and fanthom>
PS1='\[\033[01;31m\]\u@\h:\[\033[01;32m\]\w\$\[\033[00m\] '
PS2='> '
shopt -s checkwinsize
now run
Code: Select all
shopt
how about a little fun ?
add this to /root/.bashrc
Code: Select all
function xtitle() # Adds some text in the terminal frame.
{
case "$TERM" in
*term | rxvt)
echo -n -e "\033]0;$*\007" ;;
*)
;;
esac
}
xtitle= xtitle `cat /etc/porteus-version`
let me know if that helped
Joe
Re: Bash doesn't wrap long command lines with certern TERMs
@fanthom
You are right. Bash in screen doesn't wrap lines only if TERM is screen-256color. If TERM is screen, everything is OK.
@bigbass
The problem has nothing to do with bash, but thanks anyway.
Finally, I am glad to say that I have found the solution! It is because of file /etc/termcap. It only defines the termcap for xterm, but not for xterm-256color, screen or screen-256color. If I add these terminal types to the xterm termcaps (see the patch below), everything will be OK. Actually only the "up" capability is needed for bash to wrap lines (It means "cursor up one line". I'm not quite familiar with termcap and can't understand why "up one line", not "down one line".)
The termcap file in my openSUSE mashine has defined xterm-256color, screen and screen-256color, but I have found that bash still wraps lines if I delete the termcap file. So I guess the default terminfo of xterm* and screen* (they are from the ncurses library) have defined the "up" capability. Maybe updating the ncurses library will solve the problem without patching the termcap file.
Btw. I am a little bit confused with the version of the ncurses library on my openSUSE machine. The name of the .so file is /lib/libncurses{,w}.so.6.0, but the newest version of the ncurses library is 5.9.
You are right. Bash in screen doesn't wrap lines only if TERM is screen-256color. If TERM is screen, everything is OK.
@bigbass
The problem has nothing to do with bash, but thanks anyway.
Finally, I am glad to say that I have found the solution! It is because of file /etc/termcap. It only defines the termcap for xterm, but not for xterm-256color, screen or screen-256color. If I add these terminal types to the xterm termcaps (see the patch below), everything will be OK. Actually only the "up" capability is needed for bash to wrap lines (It means "cursor up one line". I'm not quite familiar with termcap and can't understand why "up one line", not "down one line".)
The termcap file in my openSUSE mashine has defined xterm-256color, screen and screen-256color, but I have found that bash still wraps lines if I delete the termcap file. So I guess the default terminfo of xterm* and screen* (they are from the ncurses library) have defined the "up" capability. Maybe updating the ncurses library will solve the problem without patching the termcap file.
Btw. I am a little bit confused with the version of the ncurses library on my openSUSE machine. The name of the .so file is /lib/libncurses{,w}.so.6.0, but the newest version of the ncurses library is 5.9.
Code: Select all
$ diff -dupN termcap.orig termcap
--- termcap.orig 2012-03-18 14:36:56.524000008 +0100
+++ termcap 2012-03-18 14:38:13.746000009 +0100
@@ -141,7 +141,7 @@ mc|minicom|ansi-mc|termcap entry for min
:tc=linux:
# Entry for an xterm. Insert mode has been disabled.
-vs|xterm|xterm-color|vs100|xterm terminal emulator (X Window System):\
+vs|xterm|xterm-256color|xterm-color|screen|screen-256color|vs100|xterm terminal emulator (X Window System):\
:am:bs:mi@:km:co#80:li#55:\
:im@:ei@:\
:ct=\E[3k:ue=\E[m:\
- fanthom
- Moderator Team
- Posts: 5667
- Joined: 28 Dec 2010, 02:42
- Distribution: Porteus Kiosk
- Location: Poland
- Contact:
Re: [Solved] Bash doesn't wrap command lines with certern TE
well done dafan
i'll push your patch to rc2 of Porteus-1.2 - thanks.
i'll push your patch to rc2 of Porteus-1.2 - thanks.
Please add [Solved] to your thread title if the solution was found.