Re: [PATCH] subshell prompt printing fix
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: [EMAIL PROTECTED] dir1] [EMAIL PROTECTED] dir2] [EMAIL PROTECTED] dir1] [EMAIL PROTECTED] dir2] I think I already submitted a code which did something similiar. I'll try to dig it out. -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
Re: [PATCH] subshell prompt printing fix
Original-Nachricht Datum: Wed, 13 Jun 2007 15:34:17 +0200 Von: Jindrich Novy An: Pavel Tsekov Betreff: Re: [PATCH] subshell prompt printing fix 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. If I remember correctly the real prompt is stripped off the control characters and trimmed to a single line due to the command prompt widget.. I think that there is a discussion in the mailing list archives - try zsh and cygwin as search keywords. -- GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS. Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel
[PATCH] subshell prompt printing fix
Hi, 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. Bug 2: 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. Tab, so that you are back. 4. Ctrl-O to go to subshell. 5. You see two same prompts printed next to each other - no prompt printing is desired in this case. The attached patch fixes both these bugs. The first one completely. The second one is worked around in the way that the new prompt is printed on the new line so that the subshell doesn't get messed up. The question is whether to use Slang calls to reprint the subshell prompt so that the new line isn't needed to be printed since the old prompt can be overwritten. Cheers, Jindrich -- Jindrich Novy [EMAIL PROTECTED] http://people.redhat.com/jnovy/ --- mc-2007-06-04-22/src/main.c.prompt 2007-06-12 15:23:25.0 +0200 +++ mc-2007-06-04-22/src/main.c 2007-06-12 15:45:08.0 +0200 @@ -453,9 +453,16 @@ do_possible_cd (const char *new_dir) void do_update_prompt (void) { +static char *old_subshell_prompt = NULL; + if (update_prompt) { - printf (%s, subshell_prompt); - fflush (stdout); + if (old_subshell_prompt == NULL + || strcmp (old_subshell_prompt, subshell_prompt)) { + g_free (old_subshell_prompt); + old_subshell_prompt = g_strdup (subshell_prompt); + printf (\r\n%s, subshell_prompt); + fflush (stdout); + } update_prompt = 0; } } ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel