summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-03-04 08:29:47 +0300
committerGrail Finder <wohilas@gmail.com>2026-03-04 08:29:47 +0300
commit50ce0200af5648818e6e4f51d6541bd3bdb7e036 (patch)
treeabdafdf40139aacdfa201024c6568518bbb90abd
parent58ccd63f4a76a8ee6ee44d30347b9a6b12833ebf (diff)
Fix: graceful shutdown in tui, to avoid other key block
-rw-r--r--main.go14
-rw-r--r--tui.go11
2 files changed, 11 insertions, 14 deletions
diff --git a/main.go b/main.go
index 334b59b..fe92327 100644
--- a/main.go
+++ b/main.go
@@ -1,7 +1,6 @@
package main
import (
- "github.com/gdamore/tcell/v2"
"github.com/rivo/tview"
)
@@ -24,19 +23,6 @@ var (
)
func main() {
- app.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
- if event.Key() == tcell.KeyCtrlC {
- logger.Info("caught Ctrl+C via tcell event")
- go func() {
- if err := pwShutDown(); err != nil {
- logger.Error("shutdown failed", "err", err)
- }
- app.Stop()
- }()
- return nil // swallow the event
- }
- return event
- })
pages.AddPage("main", flex, true, true)
if err := app.SetRoot(pages,
true).EnableMouse(cfg.EnableMouse).EnablePaste(true).Run(); err != nil {
diff --git a/tui.go b/tui.go
index 4a8a7b2..67f2775 100644
--- a/tui.go
+++ b/tui.go
@@ -1001,6 +1001,17 @@ func init() {
showBotRoleSelectionPopup()
return nil
}
+ // INFO: shutdown
+ if event.Key() == tcell.KeyCtrlC {
+ logger.Info("caught Ctrl+C via tcell event")
+ go func() {
+ if err := pwShutDown(); err != nil {
+ logger.Error("shutdown failed", "err", err)
+ }
+ app.Stop()
+ }()
+ return nil // swallow the event
+ }
if event.Key() == tcell.KeyCtrlG {
// cfg.RAGDir is the directory with files to use with RAG
// rag load