v0.29.1 d92a60f

interactive_submit.go RawHistoryFolder

1package modes
2
3import "context"
4
5// Submit feeds text through the agent loop as if the user had typed it.
6func (i *Interactive) Submit(text string) {
7	if cmd, ok := shellEscapeCommand(text); ok {
8		i.startShellEscape(i.runCtx, cmd)
9		return
10	}
11	parent := i.runCtx
12	if parent == nil {
13		parent = context.Background()
14	}
15	i.mu.Lock()
16	awaitingStartupPre := i.awaitingStartupPre
17	i.mu.Unlock()
18	if !awaitingStartupPre {
19		i.maybeStartSessionTitle(parent, text)
20	}
21	i.startTurn(parent, text)
22}
23
24// completeStartupPre applies deferred InitialInput after entry.pre finishes.
25// When AutoSubmitInitial was set, the deferred prompt is submitted; otherwise
26// it only pre-fills the editor (CLI-supplied prompts).
27func (i *Interactive) completeStartupPre() {
28	i.mu.Lock()
29	if !i.awaitingStartupPre {
30		i.mu.Unlock()
31		return
32	}
33	i.awaitingStartupPre = false
34	deferred := i.deferredInitialInput
35	auto := i.autoSubmitDeferred
36	i.deferredInitialInput = ""
37	i.autoSubmitDeferred = false
38	onDone := i.cfg.OnStartupPreDone
39	i.mu.Unlock()
40	if onDone != nil {
41		onDone()
42	}
43	i.startupPreDone <- startupPreResult{deferred: deferred, autoSubmit: auto}
44	i.invalidate()
45}
46
47// applyStartupPreResult runs on the TUI event loop so the editor remains
48// single-threaded. Input entered while resources were reloading wins over the
49// deferred prefill rather than being overwritten.
50func (i *Interactive) applyStartupPreResult(result startupPreResult) {
51	if result.deferred == "" {
52		return
53	}
54	if result.autoSubmit {
55		i.Submit(result.deferred)
56		return
57	}
58	if i.ed.IsEmpty() {
59		i.ed.SetValue(result.deferred)
60	}
61}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close