v0.51.0 a9d674e

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		// Initial and deferred input are user prompts; the startup command
21		// itself is not and leaves the pins pending.
22		text = i.consumePinnedSkills(text)
23	}
24	i.startTurn(parent, text)
25}
26
27// completeStartupPre applies deferred InitialInput after entry.pre finishes.
28// When AutoSubmitInitial was set, the deferred prompt is submitted; otherwise
29// it only pre-fills the editor (CLI-supplied prompts).
30func (i *Interactive) completeStartupPre() {
31	i.mu.Lock()
32	if !i.awaitingStartupPre {
33		i.mu.Unlock()
34		return
35	}
36	i.awaitingStartupPre = false
37	deferred := i.deferredInitialInput
38	auto := i.autoSubmitDeferred
39	i.deferredInitialInput = ""
40	i.autoSubmitDeferred = false
41	onDone := i.cfg.OnStartupPreDone
42	i.mu.Unlock()
43	if onDone != nil {
44		onDone()
45	}
46	i.startupPreDone <- startupPreResult{deferred: deferred, autoSubmit: auto}
47	i.invalidate()
48}
49
50// applyStartupPreResult runs on the TUI event loop so the editor remains
51// single-threaded. Input entered while resources were reloading wins over the
52// deferred prefill rather than being overwritten.
53func (i *Interactive) applyStartupPreResult(result startupPreResult) {
54	// entry.pre may have added or removed skills; re-resolve the pending pins
55	// without holding the interactive mutex.
56	i.refreshPendingSkillPins()
57	if result.deferred == "" {
58		return
59	}
60	if result.autoSubmit {
61		i.Submit(result.deferred)
62		return
63	}
64	if i.ed.IsEmpty() {
65		i.ed.SetValue(result.deferred)
66	}
67}

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