From 6798b669464d828c241554647b4fff68a62ca91d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 16 Feb 2026 22:53:17 +0200 Subject: Add global I/O avg line (hotkey i) and m/n hotkey aliases Add a pink 1px line drawn from the top showing mean iowait+IRQ+softIRQ across all hosts, toggled with hotkey i and persistable to ~/.loadbarsrc. Also add m as alias for 2 (memory toggle) and n as alias for 3 (network toggle) for easier single-hand operation. Co-Authored-By: Claude Opus 4.6 --- internal/config/config_test.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'internal/config/config_test.go') diff --git a/internal/config/config_test.go b/internal/config/config_test.go index db0e068..a8535be 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -115,6 +115,43 @@ func TestConfig_showAvgLineRoundTrip(t *testing.T) { } } +func TestConfig_showIOAvgLineRoundTrip(t *testing.T) { + // Write a config with showioavgline=1, read it back, verify round-trip + c := Default() + c.ShowIOAvgLine = true + + dir := t.TempDir() + path := filepath.Join(dir, "rc") + f, err := os.Create(path) + if err != nil { + t.Fatal(err) + } + if err := c.writeTo(f); err != nil { + f.Close() + t.Fatal(err) + } + f.Close() + + data, _ := os.ReadFile(path) + if !bytes.Contains(data, []byte("showioavgline=1")) { + t.Errorf("expected showioavgline=1 in output, got:\n%s", data) + } + + // Read it back + c2 := Default() + f2, err := os.Open(path) + if err != nil { + t.Fatal(err) + } + defer f2.Close() + if err := c2.parseReader(f2); err != nil { + t.Fatal(err) + } + if !c2.ShowIOAvgLine { + t.Error("expected ShowIOAvgLine=true after round-trip") + } +} + func TestGetClusterHostsFromFile(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "clusters") -- cgit v1.2.3