Subject: Re: Trouble in RXVT with line wrap
From: Randall R Schulz <[email-masked]>
To: Sandeep Tamhankar <[email-masked]>, "David A. Cobb" <[email-masked]>
Cc: Cygwin General MailList <[email-masked]>
Date: Tue, 03 Jul 2001 17:40:56 -0700

Sandeep,

That's overkill!

Use the feature that's there to prevent this miscounting. Namely, \[ 
(that's backslash and left bracket, not escape) to open a non-printing 
sub-sequence of the promt and \] (likewise, bacslash right bracket) to 
close the non-printing sub-sequence.

See section 7.10 of the BASH manual "Controlling the Prompt" (7.10 or 
thereabouts, i.e.--this is the section an old printed version I use).

Randall Schulz

At 16:08 2001-07-03, Sandeep Tamhankar wrote:
>I saw this too when I moved to rxvt.  The problem is that when you specify 
>escape characters in your PS1 (primary prompt) bad things like this 
>happen.  By default when you start up Cygwin, your PS1 is set to show the 
>current directory in your window title bar and your username (possibly 
>with host but I can't remember for certain) as your actual prompt in 
>green.  Even in the standard Windows console-app window, I get all sorts 
>of problems when I have multi-screenline commands and start doing Ctrl-a 
>and Ctrl-e.  I ended up living with it for a while, but once I started 
>using rxvt (which exploits the cr or cr/lf issue you mention), my only 
>choices were to
>
>1. Remove all escape characters from PS1 and make my cwd be at the 
>beginning of my prompt.  (Annoying since some paths can be quite long.)
>2. Bite the bullet and build zsh, which is the shell I love anyway but was 
>otherwise too lazy to build in the past.
>
>I chose a combination of the two.  Zsh lets me have a right-side prompt, 
>so that my cwd shows up on the right while my machine-name shows up on the 
>left.  If I start typing a command that requires a lot of space, the right 
>side prompt goes away for that line as soon as I touch it's first 
>character.  Plus I could specify that I only want to see the last n 
>directories in my cwd (a feature that I loved in tcsh, but which would be 
>far more painful to produce in bash).
>
>Ok, I don't want to start a "favorite-shell" war, so I'll stop now. Bottom 
>line: there is something wrong with the way...something renders the 
>characters in the window that's screwed up and has been for a while (at 
>least on my W2k machine).
>
>-Sandeep

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/