v0.51.0 a9d674e

interactive_input.go RawHistoryFolder

1package modes
2
3import (
4	"strings"
5	"time"
6
7	"github.com/bnema/zut/packages/tui"
8)
9
10// prepareInputKey applies main-editor key state that must happen before
11// routing the key to a dialog, suggestion, or editor. It returns false when
12// clipboard resolution failed and the key must not be delivered further.
13func (i *Interactive) prepareInputKey(k tui.Key) (tui.Key, bool) {
14	// A bare Escape is eligible for the session-tree gesture only while the
15	// main input owns the key. Any other key, modified Escape, or visible
16	// child interaction resets the pending first tap before normal routing.
17	if !isUnmodifiedEscape(k) || i.sessionTreeEscapeBlocked() {
18		i.mu.Lock()
19		i.doubleEscape.Reset()
20		i.mu.Unlock()
21	}
22
23	// Dialogs route keys before the main clipboard handler below. Resolve text
24	// here when a child interaction owns input so every editor and filter sees
25	// the same KeyPaste event as terminal-native bracketed paste. Main chat is
26	// left image-first to preserve macOS clipboard image attachments.
27	if k.Kind == tui.KeyPasteClipboard && i.confirmChildActive() {
28		resolved, pastedText, err := resolveClipboardText(k, tui.ReadClipboardText)
29		if err != nil {
30			i.mu.Lock()
31			i.statusErr = "clipboard paste failed: " + err.Error()
32			i.statusOK = ""
33			i.mu.Unlock()
34			return tui.Key{}, false
35		}
36		if pastedText {
37			k = resolved
38			i.mu.Lock()
39			i.statusErr = ""
40			i.statusOK = ""
41			i.mu.Unlock()
42		}
43	}
44
45	// Any key that isn't ctrl+c invalidates an armed ctrl+c-exit, so pressing
46	// ctrl+c then typing then ctrl+c much later doesn't quit unexpectedly. The
47	// hint message also goes stale; clear it.
48	if k.Kind != tui.KeyCtrlC {
49		i.mu.Lock()
50		if !i.lastCtrlC.IsZero() {
51			i.lastCtrlC = time.Time{}
52			if strings.HasPrefix(i.statusOK, "input cleared") || strings.HasPrefix(i.statusOK, "press ctrl+c") {
53				i.statusOK = ""
54			}
55		}
56		i.mu.Unlock()
57	}
58	return k, true
59}

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