mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
Forward roster key events to room when focused
This commit is contained in:
parent
dc5632e946
commit
0af8d507e1
1 changed files with 12 additions and 1 deletions
|
@ -192,6 +192,18 @@ func (rstr *RosterView) OnKeyEvent(event mauview.KeyEvent) bool {
|
||||||
Ch: event.Rune(),
|
Ch: event.Rune(),
|
||||||
Mod: event.Modifiers(),
|
Mod: event.Modifiers(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rstr.focused {
|
||||||
|
if rstr.parent.config.Keybindings.Roster[kb] == "clear" {
|
||||||
|
rstr.focused = false
|
||||||
|
rstr.selected = nil
|
||||||
|
} else {
|
||||||
|
if roomView, ok := rstr.parent.getRoomView(rstr.selected.ID, true); ok {
|
||||||
|
return roomView.OnKeyEvent(event)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch rstr.parent.config.Keybindings.Roster[kb] {
|
switch rstr.parent.config.Keybindings.Roster[kb] {
|
||||||
case "next_room":
|
case "next_room":
|
||||||
if index := rstr.index(rstr.selected); index == -1 || index == len(rstr.rooms)-1 {
|
if index := rstr.index(rstr.selected); index == -1 || index == len(rstr.rooms)-1 {
|
||||||
|
@ -206,7 +218,6 @@ func (rstr *RosterView) OnKeyEvent(event mauview.KeyEvent) bool {
|
||||||
rstr.selected = rstr.rooms[index-1]
|
rstr.selected = rstr.rooms[index-1]
|
||||||
}
|
}
|
||||||
case "clear":
|
case "clear":
|
||||||
rstr.focused = false
|
|
||||||
rstr.selected = nil
|
rstr.selected = nil
|
||||||
case "quit":
|
case "quit":
|
||||||
rstr.parent.gmx.Stop(true)
|
rstr.parent.gmx.Stop(true)
|
||||||
|
|
Loading…
Add table
Reference in a new issue