Rebind char cycling to ,/. instead of [/]
All checks were successful
Docker / build-and-push (push) Successful in 50s
All checks were successful
Docker / build-and-push (push) Successful in 50s
[ and ] needed a reach/shift on most layouts and felt awkward next to the otherwise all-unshifted control scheme (hjkl, space, digits). , and . are adjacent, unshifted, easy to hit without looking away from the canvas -- a natural prev/next pair. Old bindings kept as a fallback rather than removed. Verified both in isolation (Update() with a KeyMsg) and live over a real SSH session -- the status-line ink swatch visibly cycles from █ to ▓ on a fresh connection. An initial live test after the rebind appeared to fail, but that traced to a stale session left over from the server restart, not an actual bug -- confirmed working correctly on a fresh connection. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -118,3 +118,27 @@ func newTestRenderer() *lipgloss.Renderer {
|
||||
r.SetColorProfile(termenv.TrueColor)
|
||||
return r
|
||||
}
|
||||
|
||||
func TestCommaPeriodCharCycling(t *testing.T) {
|
||||
c := NewCanvas()
|
||||
m := NewModel(c, "test-id", "tester", newTestRenderer())
|
||||
c.Join("test-id", "tester", nil)
|
||||
|
||||
mi, _ := m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune("x")}) // exit intro
|
||||
m = mi.(Model)
|
||||
|
||||
t.Logf("charIdx before: %d", m.charIdx)
|
||||
mi, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(".")})
|
||||
m = mi.(Model)
|
||||
t.Logf("charIdx after '.': %d", m.charIdx)
|
||||
if m.charIdx != 1 {
|
||||
t.Fatalf("expected charIdx=1 after '.', got %d", m.charIdx)
|
||||
}
|
||||
|
||||
mi, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune(",")})
|
||||
m = mi.(Model)
|
||||
t.Logf("charIdx after ',': %d", m.charIdx)
|
||||
if m.charIdx != 0 {
|
||||
t.Fatalf("expected charIdx=0 after ',', got %d", m.charIdx)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user