bar: deduplicate empty-section filtering logic between calcNonBarWidth and cleanEmptySections #3

Open
opened 2026-07-15 19:11:14 +00:00 by the.auditor · 0 comments
Owner

calcNonBarWidth() in bar/bar.go:250-258 duplicates the empty-section filtering logic already present in cleanEmptySections() (bar/bar.go:343-357). Both strip " | " segments where trimmed content is "", "/", "/s", or "<".

Consider refactoring calcNonBarWidth to reuse cleanEmptySections after placeholder substitution, or extract the shared filtering into a helper. This reduces duplication and ensures consistent behavior if the filter conditions evolve.

Spotted during review of PR #2.

`calcNonBarWidth()` in `bar/bar.go:250-258` duplicates the empty-section filtering logic already present in `cleanEmptySections()` (`bar/bar.go:343-357`). Both strip `" | "` segments where trimmed content is `""`, `"/"`, `"/s"`, or `"<"`. Consider refactoring `calcNonBarWidth` to reuse `cleanEmptySections` after placeholder substitution, or extract the shared filtering into a helper. This reduces duplication and ensures consistent behavior if the filter conditions evolve. Spotted during review of PR #2.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/konsoru#3
No description provided.