fix(coding-agent/tui): fixed background color stability in output blocks with SGR reset sequences
- Fixed background color stability in output blocks when inner content contains SGR reset sequences, preventing background color from being cleared mid-line.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Added resumption hint printed to stderr on session exit showing command to resume the session (e.g., `Resume this session with claude --resume <session-id>`)
|
||||
@@ -78,6 +79,7 @@
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed background color stability in output blocks when inner content contains SGR reset sequences, preventing background color from being cleared mid-line
|
||||
- Fixed spurious ellipsis appended to output lines that were already padded to terminal width by trimming trailing spaces before truncation check
|
||||
- Fixed config file parsing to properly handle missing files instead of treating them as errors
|
||||
- Fixed truncation indicator in truncate tool to use ellipsis character (…) instead of verbose '[truncated]' suffix
|
||||
|
||||
@@ -32,7 +32,18 @@ export function renderOutputBlock(options: OutputBlockOptions, theme: Theme): st
|
||||
? "accent"
|
||||
: "dim";
|
||||
const border = (text: string) => theme.fg(borderColor, text);
|
||||
const bgFn = state && applyBg ? (text: string) => theme.bg(getStateBgColor(state), text) : undefined;
|
||||
const bgFn = (() => {
|
||||
if (!state || !applyBg) return undefined;
|
||||
const bgAnsi = theme.getBgAnsi(getStateBgColor(state));
|
||||
// Keep block background stable even if inner content contains SGR resets (e.g. "\x1b[0m"),
|
||||
// which would otherwise clear the outer background mid-line.
|
||||
return (text: string) => {
|
||||
const stabilized = text
|
||||
.replace(/\x1b\[(?:0)?m/g, m => `${m}${bgAnsi}`)
|
||||
.replace(/\x1b\[49m/g, m => `${m}${bgAnsi}`);
|
||||
return `${bgAnsi}${stabilized}\x1b[49m`;
|
||||
};
|
||||
})();
|
||||
|
||||
const buildBarLine = (leftChar: string, rightChar: string, label?: string, meta?: string): string => {
|
||||
const left = border(`${leftChar}${cap}`);
|
||||
|
||||
Reference in New Issue
Block a user