mirror of
https://github.com/postgres/postgres.git
synced 2025-05-08 07:21:33 +03:00
psql: Fix %w length in PROMPT2 when PROMPT1 contains a newline.
The width of the invisible PROMPT2 must take into account, in order for user input to be aligned with the first line, that PROMPT1 can contain newlines. Author: Maxence Ahlouche Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAJeaomVyLSP_Wj%3D0FtYNTuoopWHyFarhUtYKDHs0HHv%2Bb%3DN9sA%40mail.gmail.com
This commit is contained in:
parent
c185a57753
commit
1713a0013f
@ -373,7 +373,10 @@ get_prompt(promptStatus_t status, ConditionalStack cstack)
|
|||||||
if (visible)
|
if (visible)
|
||||||
{
|
{
|
||||||
chwidth = PQdsplen(p, pset.encoding);
|
chwidth = PQdsplen(p, pset.encoding);
|
||||||
if (chwidth > 0)
|
|
||||||
|
if (*p == '\n')
|
||||||
|
last_prompt1_width = 0;
|
||||||
|
else if (chwidth > 0)
|
||||||
last_prompt1_width += chwidth;
|
last_prompt1_width += chwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user