Re: Home key doesn't work on properly on prompts with ANSI escapes

2007-10-29 Thread Bob Proulx
Christian Schubert wrote:
>   PS1='\e[32m$\e[m'

Non-printing characters need to be bracked with \[...\] to inform bash
that they do not display.  Please see the bash documentation in the
section on "PROMPTING".

\[ begin  a sequence of non-printing characters, which could
   be used to embed a terminal  control  sequence  into  the
   prompt
\] end a sequence of non-printing characters

I believe that will fix your problem.

Bob




Home key doesn't work on properly on prompts with ANSI escapes

2007-10-29 Thread Christian Schubert
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-gcc
Compilation 
CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' 
-DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' 
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  
-I. -I./include -I./lib   -Os -march=pentium-m -pipe -fomit-frame-pointer
uname output: Linux apexomobil 2.6.23 #56 SMP PREEMPT Mon Oct 15 21:52:48 CEST 
2007 i686 Genuine Intel(R) CPU T2500 @ 2.00GHz GenuineIntel GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 3.2
Patch Level: 17
Release Status: release

Description:
With PS1='\e[32m$\e[m' when typing something at the prompt, then
pressing  the visible cursor is not positioned after the 
prompt ($) but behind the 8th typed character, the real cursor
is on the correct position, so when editing visible and real
command lines differ.

Example:

at the given prompt type e.g.: cd /home/apexo/
result:

$cd /home/apexo/
 ^ cursor is now here

now typing: echo  yields:
echoes "cd /home/apexo/"

I encountered this problem on the first 3.2 version I tested (which is 
quite
some time ago now ... 3.1 doesn't has this bug)
  

Repeat-By:
PS1='\e[32m$\e[m'
type at least 11 characters
press 
-> cursor is not where it is supposed to be, editing/deleting
characters now messes up the displayed command line (i.e. it
doesn't reflect what's in the buffer)




Re: Home key doesn't work on properly on prompts with ANSI escapes

2007-10-29 Thread Christian Schubert
Sorry for not reading the documentation ... it just used to work and I didn't 
expect it to break :)

Thanks for clarifying things.

Regards,
Christian


On Monday 29 October 2007 18:26:06 Bob Proulx wrote:
> Christian Schubert wrote:
> > PS1='\e[32m$\e[m'
>
> Non-printing characters need to be bracked with \[...\] to inform bash
> that they do not display.  Please see the bash documentation in the
> section on "PROMPTING".
>
> \[ begin  a sequence of non-printing characters, which could
>be used to embed a terminal  control  sequence  into  the
>prompt
> \] end a sequence of non-printing characters
>
> I believe that will fix your problem.
>
> Bob