summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-12-03 12:50:23 +0300
committerGrail Finder <wohilas@gmail.com>2025-12-03 12:50:23 +0300
commite5eaba1d5a6c07b3a02d38dcc81dbac49bffcc38 (patch)
treec80cd95111a863343a329015ab191151b91f0ea3
parent3c70f0e10421861ee8cf4fbf00ccbf4b588b35ff (diff)
Enha: x to exit from a table
-rw-r--r--tables.go42
1 files changed, 37 insertions, 5 deletions
diff --git a/tables.go b/tables.go
index 755f255..6baf9d6 100644
--- a/tables.go
+++ b/tables.go
@@ -49,7 +49,7 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table {
}
}
chatActTable.Select(0, 0).SetFixed(1, 1).SetDoneFunc(func(key tcell.Key) {
- if key == tcell.KeyEsc || key == tcell.KeyF1 {
+ if key == tcell.KeyEsc || key == tcell.KeyF1 || key == tcell.Key('x') {
pages.RemovePage(historyPage)
return
}
@@ -166,6 +166,14 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table {
return
}
})
+ // Add input capture to handle 'x' key for closing the table
+ chatActTable.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
+ if event.Key() == tcell.KeyRune && event.Rune() == 'x' {
+ pages.RemovePage(historyPage)
+ return nil
+ }
+ return event
+ })
return chatActTable
}
@@ -441,7 +449,7 @@ func makeAgentTable(agentList []string) *tview.Table {
}
}
chatActTable.Select(0, 0).SetFixed(1, 1).SetDoneFunc(func(key tcell.Key) {
- if key == tcell.KeyEsc || key == tcell.KeyF1 {
+ if key == tcell.KeyEsc || key == tcell.KeyF1 || key == tcell.Key('x') {
pages.RemovePage(agentPage)
return
}
@@ -493,6 +501,14 @@ func makeAgentTable(agentList []string) *tview.Table {
return
}
})
+ // Add input capture to handle 'x' key for closing the table
+ chatActTable.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
+ if event.Key() == tcell.KeyRune && event.Rune() == 'x' {
+ pages.RemovePage(agentPage)
+ return nil
+ }
+ return event
+ })
return chatActTable
}
@@ -522,8 +538,8 @@ func makeCodeBlockTable(codeBlocks []string) *tview.Table {
}
}
table.Select(0, 0).SetFixed(1, 1).SetDoneFunc(func(key tcell.Key) {
- if key == tcell.KeyEsc || key == tcell.KeyF1 {
- pages.RemovePage(agentPage)
+ if key == tcell.KeyEsc || key == tcell.KeyF1 || key == tcell.Key('x') {
+ pages.RemovePage(codeBlockPage)
return
}
if key == tcell.KeyEnter {
@@ -553,6 +569,14 @@ func makeCodeBlockTable(codeBlocks []string) *tview.Table {
return
}
})
+ // Add input capture to handle 'x' key for closing the table
+ table.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
+ if event.Key() == tcell.KeyRune && event.Rune() == 'x' {
+ pages.RemovePage(codeBlockPage)
+ return nil
+ }
+ return event
+ })
return table
}
@@ -578,7 +602,7 @@ func makeImportChatTable(filenames []string) *tview.Table {
}
}
chatActTable.Select(0, 0).SetFixed(1, 1).SetDoneFunc(func(key tcell.Key) {
- if key == tcell.KeyEsc || key == tcell.KeyF1 {
+ if key == tcell.KeyEsc || key == tcell.KeyF1 || key == tcell.Key('x') {
pages.RemovePage(historyPage)
return
}
@@ -629,6 +653,14 @@ func makeImportChatTable(filenames []string) *tview.Table {
return
}
})
+ // Add input capture to handle 'x' key for closing the table
+ chatActTable.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
+ if event.Key() == tcell.KeyRune && event.Rune() == 'x' {
+ pages.RemovePage(historyPage)
+ return nil
+ }
+ return event
+ })
return chatActTable
}