(ctx context.Context, ev uv.KeyPressEvent, inputValue string, editing bool)
| 581 | } |
| 582 | |
| 583 | func (h *shellCallHandler) ReactToInput(ctx context.Context, ev uv.KeyPressEvent, inputValue string, editing bool) func() { |
| 584 | key := uv.Key(ev) |
| 585 | switch { |
| 586 | case key.MatchString(">"): |
| 587 | if inputValue == "" { |
| 588 | h.mode = modePrompt |
| 589 | return func() { |
| 590 | h.llm(ctx) // initialize LLM |
| 591 | } |
| 592 | } |
| 593 | case key.MatchString("!"): |
| 594 | if inputValue == "" { |
| 595 | h.mode = modeShell |
| 596 | return noop // handled, no async work |
| 597 | } |
| 598 | case key.MatchString("ctrl+x"): |
| 599 | if h.llmSession != nil { |
| 600 | h.llmSession.ToggleAutocompact() |
| 601 | return noop |
| 602 | } |
| 603 | case key.MatchString("ctrl+s"): |
| 604 | if h.llmSession != nil { |
| 605 | return func() { |
| 606 | if err := h.llmSession.SyncToLocal(ctx); err != nil { |
| 607 | slog.Error("failed to sync changes to local filesystem", "error", err.Error()) |
| 608 | Frontend.SetSidebarContent(idtui.SidebarSection{ |
| 609 | Title: "Changes", |
| 610 | Content: termenv.String("SAVE ERROR: " + err.Error()).Foreground(termenv.ANSIRed).String(), |
| 611 | }) |
| 612 | } |
| 613 | } |
| 614 | } |
| 615 | case key.MatchString("ctrl+u"): |
| 616 | if h.llmSession != nil { |
| 617 | return func() { |
| 618 | if err := h.llmSession.SyncFromLocal(ctx); err != nil { |
| 619 | slog.Error("failed to load current working directory into agent workspace", "error", err.Error()) |
| 620 | Frontend.SetSidebarContent(idtui.SidebarSection{ |
| 621 | Title: "Changes", |
| 622 | Content: termenv.String("UPLOAD ERROR: " + err.Error()).Foreground(termenv.ANSIRed).String(), |
| 623 | }) |
| 624 | } |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | return nil |
| 629 | } |
| 630 | |
| 631 | func noop() {} |
| 632 |
nothing calls this directly
no test coverage detected