subshell prompt fix

Leonard den Ottolander leonard at den.ottolander.nl
Thu Nov 18 15:26:37 UTC 2004


Hi Jindrich,

On Thu, 2004-11-18 at 11:16, Jindrich Novy wrote:
> The second patch behaves more "rigorously" as it sets the position to
> the beginning and assumes that '\r' won't clear the line. So it clears
> only the part of the line, where the previous prompt was written. So it
> remembers a size of previous prompt. This frees us from solving of COLS,
> etc. problems and won't draw more characters than needed.

Not entirely. The maximum number of cleared characters should be capped.
Using 256 here. MAXCOLS etc should be cleaned up later as I mentioned in
my patch, after which we could use that value instead of the hardcoded
256.

+       printf ("\r%*c\r%s", prompt_lastsize > 256 ? 256 :
prompt_lastsize, ' ', subshell_prompt);

But maybe we should wait with committing this patch for a while. It
might be a good idea to do some cleaning up in subshell.c and we might
end up with the #ifdef __linux__ turning out to be unnecessary.

Actually, the #ifdef __linux__ seems redundant altogether, as this
prompt fix doesn't cause any regression on FreeBSD IIUC. Prompt on
FreeBSD is totally absent in some cases as I understand from Pavel
Shirshov.

Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research





More information about the mc-devel mailing list