Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: since 4.3.4, artifact-appearance at prompt
- X-seq: zsh-users 12190
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: since 4.3.4, artifact-appearance at prompt
- Date: Sun, 04 Nov 2007 15:48:39 -0800
- In-reply-to: <20071104221621.GB28076@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20071103234335.GB10499@xxxxxxxxx> <071103183038.ZM8388@xxxxxxxxxxxxxxxxxxxxxx> <20071104034810.GA3923@xxxxxxxxx> <20071104070008.15348.qmail@xxxxxxxxxxx> <071104094803.ZM22628@xxxxxxxxxxxxxxxxxxxxxx> <20071104221621.GB28076@xxxxxxxxx>
On Nov 4, 2:16pm, Wayne Davison wrote:
} Subject: Re: since 4.3.4, artifact-appearance at prompt
}
} On Sun, Nov 04, 2007 at 09:48:03AM -0800, Bart Schaefer wrote:
} > function precmd {
} > # An efficient version using termcap multi-right:
} > print -nP '%B%S%#%s%b' # Output % or #
} > echotc RI $((COLUMNS - 3))
} > echo -n ' ' # Output 2 spaces
} > }
}
} You should replace the 2-space echo with a print that also outputs a CR:
}
} print -n ' \r'
In that case we ought to update both the FAQ, and the C code that
handles PROMPT_SP. I copied the above right out of the FAQ, except
for changing the first "print".
} Yes, the PROMPT_CR option is going to output a CR too, but it does so
} after enough of a delay that I would sometimes see an inverted % on an
} empty line if my type-ahead echoed between the PROMPT_SP output and the
} PROMPT_CR output.
This appears to be what Russell is experiencing, too.
} It is better to output the %P portion as early as possible in the
} post-command-run code, so outputting it as an actual part of the prompt
} would probably not be desirable.
I'm willing to believe that.
} e.g.:
}
} PROMPTSP=%{%B%S%}%#%{%s%b%}
The internals of prompting already know that %B%S and %s%b don't occupy
any space. %{...%} shouldn't be needed there.
} However, an alternative to having the user use %{ ... %} would be to
} have the user just tell us how wide their string is:
}
} PROMPTSP=1:%B%S%#%s%b
The countprompt() function is exported from prompt.c for ZLE's use, so
I don't think there's much to be gained there.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author