fix: improve separator rendering logic to look backwards for content

- Enhanced separator rendering to check all previous widgets for actual content
- Prevents separators from being skipped when there are widgets that don't render but others before them do
- Improves status line layout consistency by properly detecting content presence
This commit is contained in:
muserquantity committed 2025-09-07 18:50:01 +08:00
1 parent c106958f36
commit 66214c950c
1 file changed
+14 -1
+14 -1
View File
@@ -705,7 +705,20 @@ export function renderStatusLine(
// Handle separators specially (they're not widgets)
if (widget.type === 'separator') {
if (i > 0 && !preRenderedWidgets[i - 1]?.content)
// Check if there's any widget before this separator that actually rendered content
// Look backwards to find ANY widget that produced content
let hasContentBefore = false;
for (let j = i - 1; j >= 0; j--) {
const prevWidget = widgets[j];
if (prevWidget && prevWidget.type !== 'separator' && prevWidget.type !== 'flex-separator') {
if (preRenderedWidgets[j]?.content) {
hasContentBefore = true;
break;
}
// Continue looking backwards even if this widget didn't render content
}
}
if (!hasContentBefore)
continue;
const sepChar = widget.character ?? (settings.defaultSeparator ?? '|');