Use STATUSLINE_WIDTH env var for reliable width detection

term.GetSize returns unreliable values when running inside Claude Code
over SSH. Replace the hardcoded statuslineWidthOffset with STATUSLINE_WIDTH
env var (set in Claude Code settings), falling back to terminal detection,
then 80 columns.
This commit is contained in:
2026-02-08 23:27:26 +01:00
parent a06aa4c549
commit 27128e2e3b
2 changed files with 16 additions and 17 deletions

View File

@@ -756,10 +756,9 @@ func TestTokenUsage_ZeroValues(t *testing.T) {
}
}
func TestStatuslineWidthOffset_Constant(t *testing.T) {
// Verify the constant is defined and reasonable
if statuslineWidthOffset <= 0 || statuslineWidthOffset > 20 {
t.Errorf("statuslineWidthOffset = %d, expected between 1 and 20", statuslineWidthOffset)
func TestDefaultStatuslineWidth_Constant(t *testing.T) {
if defaultStatuslineWidth < 40 || defaultStatuslineWidth > 300 {
t.Errorf("defaultStatuslineWidth = %d, expected between 40 and 300", defaultStatuslineWidth)
}
}