Переглянути джерело

fix(ui/chat): keep mentions layer non-interactive for key routing

ayn2op 1 місяць тому
батько
коміт
3656acba48
2 змінених файлів з 7 додано та 12 видалено
  1. 6 12
      internal/ui/chat/message_input.go
  2. 1 0
      internal/ui/chat/model.go

+ 6 - 12
internal/ui/chat/message_input.go

@@ -104,9 +104,9 @@ func (mi *messageInput) stopTypingTimer() {
 }
 
 func (mi *messageInput) HandleEvent(event tcell.Event) tview.Command {
+	handler := mi.TextArea.HandleEvent
 	switch event := event.(type) {
 	case *tview.KeyEvent:
-		handler := mi.TextArea.HandleEvent
 		switch {
 		case keybind.Matches(event, mi.cfg.Keybinds.MessageInput.Paste.Keybind):
 			mi.paste()
@@ -171,26 +171,20 @@ func (mi *messageInput) HandleEvent(event tcell.Event) tview.Command {
 			if mi.chat.GetVisible(mentionsListLayerName) {
 				switch {
 				case keybind.Matches(event, mi.cfg.Keybinds.MentionsList.Up.Keybind):
-					mi.mentionsList.HandleEvent(tcell.NewEventKey(tcell.KeyUp, "", tcell.ModNone))
-					return nil
+					return mi.mentionsList.HandleEvent(tcell.NewEventKey(tcell.KeyUp, "", tcell.ModNone))
 				case keybind.Matches(event, mi.cfg.Keybinds.MentionsList.Down.Keybind):
-					mi.mentionsList.HandleEvent(tcell.NewEventKey(tcell.KeyDown, "", tcell.ModNone))
-					return nil
+					return mi.mentionsList.HandleEvent(tcell.NewEventKey(tcell.KeyDown, "", tcell.ModNone))
 				case keybind.Matches(event, mi.cfg.Keybinds.MentionsList.Top.Keybind):
-					mi.mentionsList.HandleEvent(tcell.NewEventKey(tcell.KeyHome, "", tcell.ModNone))
-					return nil
+					return mi.mentionsList.HandleEvent(tcell.NewEventKey(tcell.KeyHome, "", tcell.ModNone))
 				case keybind.Matches(event, mi.cfg.Keybinds.MentionsList.Bottom.Keybind):
-					mi.mentionsList.HandleEvent(tcell.NewEventKey(tcell.KeyEnd, "", tcell.ModNone))
-					return nil
+					return mi.mentionsList.HandleEvent(tcell.NewEventKey(tcell.KeyEnd, "", tcell.ModNone))
 				}
 			}
 
 			go mi.chat.app.QueueUpdateDraw(func() { mi.tabSuggestion() })
 		}
-
-		return handler(event)
 	}
-	return mi.TextArea.HandleEvent(event)
+	return handler(event)
 }
 
 func (mi *messageInput) paste() {

+ 1 - 0
internal/ui/chat/model.go

@@ -113,6 +113,7 @@ func (m *Model) buildLayout() {
 		layers.WithName(mentionsListLayerName),
 		layers.WithResize(false),
 		layers.WithVisible(false),
+		layers.WithEnabled(false),
 	)
 }