You are not logged in.

#1 2009-11-23 23:02:42

xelados
Member
Registered: 2007-06-02
Posts: 314
Website

[SOLVED] How to make wordwrap work properly in bash/urxvt?

When I am working with filenames that are particularly long and the line has to wrap, it wraps over the /current/ line instead of the one after, so I get a garbled display. Is there anything I can do to fix it? I was told that it may have something to do with my bash prompt:

\[\e[1;37m\]\u\[\e[0m\]@\e[32m\]\h\e[0m\]: \e[35m\]\w\[\e[0m\] $ 

Outputs: xelados@mini-spork: ~ $

Is something malformed?

Last edited by xelados (2009-11-24 00:04:22)

Offline

#2 2009-11-23 23:15:24

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [SOLVED] How to make wordwrap work properly in bash/urxvt?

xelados wrote:

When I am working with filenames that are particularly long and the line has to wrap, it wraps over the /current/ line instead of the one after, so I get a garbled display. Is there anything I can do to fix it? I was told that it may have something to do with my bash prompt:

\[\e[1;37m\]\u\[\e[0m\]@\e[32m\]\h\e[0m\]: \e[35m\]\w\[\e[0m\] $

Is something malformed?

There seems to be 2 missing escapes ("\["):

\[\e[1;37m\]  \u  \[\e[0m\]  @    \e[32m\]  \h\e[0m\]  :   \e[35m\]  \w  \[\e[0m\] $
\[\e[1;37m\]  \u  \[\e[0m\]  @  \[\e[32m\]  \h\e[0m\]  : \[\e[35m\]  \w  \[\e[0m\] $

Even with all of the escapes I still have problems with wrapping quite often with urxvt. When that happens, I just resize the screen and it seems to update the internal number of columns.



*edit*
Make that 3:

\[\e[1;37m\]  \u  \[\e[0m\]  @    \e[32m\]  \h    \e[0m\]  :   \e[35m\]  \w  \[\e[0m\] $
\[\e[1;37m\]  \u  \[\e[0m\]  @  \[\e[32m\]  \h  \[\e[0m\]  : \[\e[35m\]  \w  \[\e[0m\] $

Last edited by Xyne (2009-11-24 01:24:03)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2009-11-24 00:03:59

xelados
Member
Registered: 2007-06-02
Posts: 314
Website

Re: [SOLVED] How to make wordwrap work properly in bash/urxvt?

\[\e[1;37m\]\u\[\e[0m\]@\e[32m\]\h\e[0m\]: \e[35m\]\w\[\e[0m\] $

the solution:

\[\e[1;37m\]\u\[\e[0m\]@\[\e[32m\]\h\[\e[0m\]: \[\e[35m\]\w\[\e[0m\] $

It seems like I needed an escape just after \h, as well. Thanks for pointing that out, though; it works now!

Offline

#4 2009-11-24 01:26:25

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [SOLVED] How to make wordwrap work properly in bash/urxvt?

Ooops, missed that one... yeah, they're hard to catch.

I found it was easier to use variables instead:

COLOR_1="\[\e[1;37m\]"
COLOR_2="\[\e[0;37m\]"
COLOR_3="\[\e[1;34m\]"
COLOR_4="\[\e[1;30m\]"
PS1="${COLOR_3}[${COLOR_2}\u...

My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2009-12-01 09:57:31

xelados
Member
Registered: 2007-06-02
Posts: 314
Website

Re: [SOLVED] How to make wordwrap work properly in bash/urxvt?

It seems to only selectively work. I wonder what's causing it. Perhaps a bash-fu master can help?

Offline

Board footer

Powered by FluxBB