[PATCH] subshell prompt printing fix
Jindrich Novy
jnovy at redhat.com
Wed Jun 13 13:47:04 UTC 2007
Hi Pavel,
On Wed, Jun 13, 2007 at 02:11:33PM +0200, Jindrich Novy wrote:
> On Wed, Jun 13, 2007 at 02:02:54PM +0200, Pavel Tsekov wrote:
> > -------- Original-Nachricht --------
> > Datum: Tue, 12 Jun 2007 16:17:11 +0200
> > Von: Jindrich Novy
> > Betreff: [PATCH] subshell prompt printing fix
> >
> > > I've been stumbling around this problem for a long time
> > > so I finally decided to fix it.
> > >
> > > Bug 1:
> > > 1. Have a mc running where you have two different directories
> > > in each panel.
> > > 2. Tab, so that you are in the other panel.
> > > 3. Ctrl-O to go to subshell.
> > > 4. You see two different prompts printed next to each other.
> >
> > How about clearing the last line and printing the prompt with
> > terminal control codes ? With your patch we'll get something like:
>
> This is a good way to go. If you have already done it and it works,
> we can update the prompt printing part then.
>
> >
> > [user at host dir1]
> > [user at host dir2]
> > [user at host dir1]
> > [user at host dir2]
> >
> > I think I already submitted a code which did something similiar. I'll try to dig it out.
> >
Maybe yet another point. mc prints command prompt without the control codes what perfectly
makes sense within mc. Also it prints only the last line in case that user has multiline
PS1, for example:
PS1='\[\033[01;31m\]\H\[\033[00m\]:\[\033[00;01m\]\w\n\033[01;34m\]\$ \[\033[00m\]'
Doesn't it make sense to print the complete prompt to the subshell in respect to PS1
including control codes? In case you rely on the fact that the prompt is single-lined,
which is not in this case, the rewriting of the prompt using control codes, as you propose,
will be broken.
After thinking more about it, it would be better to print the prompt again each time a
cwd in mc is changed. If we do so, we can support the multiline PS1s as well.
Jindrich
--
Jindrich Novy <jnovy at redhat.com> http://people.redhat.com/jnovy/
More information about the mc-devel
mailing list