Fwd: Re: Newbie: raw_input and other input methods


You might remember my color prompt problem.

Well, here is the fix. Excuse me if you feel spammed! I just wanted to 
share this with anyone who might have this problem at some time.

Use bash as shell, putting it in env variable if necessary and never 
have to reset terminal size!

Thanx to all who helped me with this!

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 11/25/99, 6:09:32 PM, Carel Fellinger <cfelling@iae.nl> wrote 
regarding Re: Newbie: raw_input and other input methods:

> Hassan Aurag <aurag@geocities.com> wrote:

> > Anyway, I used raw_input to be able to use readline and its nifty back
> > arrow, up arrow...

> > However when I wanted to have a nifty prompt like the following one:

> > raw_input("\033[0;34mInput: \033[0m"), I was surprised it got all
> > screwed up.

> bash copes with this, so I dived into the source. And low and behold
> there it is: bash uses the readline special codes 
> (='\001') and RL_PROMPT_END_IGNORE (='\002') to tell readline to 
> the chars in between.  Using this info you can get what you want:)

> e.g.
> >>>raw_input('\001\033[0:34m\002Input: \001\033[0m\002')

> works like a charm, atleast here on my linux box

> --
> groetjes, carel

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]