internal/system/event.go uses key chords in tomo/config

This commit is contained in:
Sasha Koshka 2024-09-12 01:10:52 -04:00
parent b6850ee702
commit 42deb40c2d

View File

@ -2,6 +2,7 @@ package system
import "image"
import "git.tebibyte.media/tomo/tomo/input"
import "git.tebibyte.media/tomo/tomo/config"
// TODO: once go v1.23 comes out, replace the explicit iterator calls here with
// range loops
@ -39,15 +40,14 @@ func (this *Hierarchy) HandleKeyDown (key input.Key, numberPad bool) {
}
if caught { return }
switch key {
case input.KeyTab:
if this.modifiers.Shift {
this.focusPrevious()
} else {
this.focusNext()
}
case input.KeyUp: this.focusPrevious()
case input.KeyDown: this.focusNext()
switch input.KC(key, this.modifiers) {
case config.KeyChordFocusNext: this.focusNext()
case config.KeyChordFocusPrevious: this.focusPrevious()
// TODO: up, down, left, and right should find a box to the top, bottom,
// left, and right respectively to move the focus to. we might want to
// have four corresponding key chords in tomo/config.
case input.KC(input.KeyDown, input.ModNone): this.focusNext()
case input.KC(input.KeyUp, input.ModNone): this.focusPrevious()
}
}