model-writtenrun 8894 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Thomas Munro proposed an invisible continuation prompt for easier copying of multiline SQL, attaching an implementation where %w produced spaces matching the database name's length #1.
- Dagfinn Ilmari Mannsåker pointed out that other variable-width prompt fields would break alignment and proposed a whitespace-producing delimiter pair #3; Tom Lane preferred matching all of PROMPT1 #4, while Alvaro Herrera favored the more general delimiter approach #7 and Chapman Flack suggested filling the width remaining after other prompt elements #6.
- Discussion of reusing PROMPT1 exposed the difference between literal variable expansion and rendered prompt output #9 #10; Kyotaro Horiguchi noted that shell-command expansions could change between evaluations #11, leading Tom Lane to propose caching the visible width of the last generated PROMPT1 while excluding hidden escape sequences #12.
- Thomas Munro implemented the cached-width design in #13, initially counting bytes, then adopted Tom Lane's recommendation to use character display widths #16, producing a multibyte-aware revision in #17.
- Tom Lane requested checking character length before computing display width, explicitly initializing the cached width, and documenting that %w matches the most recent PROMPT1 output #18; Thomas Munro incorporated those changes and additionally ignored nonpositive display widths, landing 7f338369ca from #17 and announcing it in #19.
- David Fetter then supplied a separate refactoring delta that moved the width calculation into a reusable visible_length() helper in common.c #20, but the supplied thread shows no subsequent review or landing of that proposal.
- Maxence Ahlouche reported that multiline PROMPT1 values made continuation input align too far to the right and supplied a fix resetting the accumulated width at each newline #21.
- Tom Lane found that newlines inside invisible escape sequences must not reset the width and requested placing the reset inside the visible-character branch; he also raised tab-stop handling as another possible special case #22.
- Maxence Ahlouche revised the newline fix as requested in #23, explaining that invisible terminal-title sequences could contain newlines and leaving tabs unresolved because tab stops are configurable and reproducing them would require more machinery.
- Thomas Munro committed the revised newline fix from #23 unchanged apart from rebasing as 1713a0013f and confirmed completion in #24; the feature and newline correction had landed, while the helper extraction and tab handling remained unlanded in the supplied record.