Reworking Keymaps

This commit is contained in:
2025-10-26 08:47:07 -05:00
parent cf47b5a4e4
commit d63e3a414a
30 changed files with 384 additions and 715 deletions

View File

@@ -45,7 +45,7 @@ type AbsoluteLayout struct {
visible bool
focusable bool
keyMap KeyMap
keyMap *KeyMap
cursor int
disableTab bool
@@ -80,17 +80,8 @@ func (w *AbsoluteLayout) HandleResize(ev *tcell.EventResize) {
w.updateWidgetLayouts()
}
// AbsoluteLayout doesn't have a default keymap
func (w *AbsoluteLayout) SetKeyMap(km KeyMap, def bool) { w.keyMap = km }
func (w *AbsoluteLayout) AddToKeyMap(km KeyMap) { w.keyMap.Merge(km) }
func (w *AbsoluteLayout) RemoveFromKeyMap(km KeyMap) {
for k := range km.Keys {
w.keyMap.Remove(k)
}
for r := range km.Runes {
w.keyMap.RemoveRune(r)
}
}
func (w *AbsoluteLayout) GetKeyMap() *KeyMap { return w.keyMap }
func (w *AbsoluteLayout) SetKeyMap(km *KeyMap) { w.keyMap = km }
func (w *AbsoluteLayout) HandleKey(ev *tcell.EventKey) bool {
if !w.disableTab && ev.Key() == tcell.KeyTab {