psql_prompt.patch
text/x-patch
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/bin/psql/prompt.c | 5 | 0 |
commit 7fca5709d3ada8cf0b4219c707562cd841c997d2 (HEAD -> refs/heads/psql_prompt)
Author: Maxence Ahlouche <maxence.ahlouche@gmail.com>
Date: Wed Nov 27 16:21:35 2019 +0100
Fix %w length in PROMPT2 when PROMPT1 contains a newline, in psql.
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.
diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c
index 41c6f21ecf..a844c384bb 100644
--- a/src/bin/psql/prompt.c
+++ b/src/bin/psql/prompt.c
@@ -366,6 +366,11 @@ get_prompt(promptStatus_t status, ConditionalStack cstack)
visible = true;
++p;
}
+ else if (*p == '\n')
+ {
+ last_prompt1_width = 0;
+ ++p;
+ }
else
#endif
{