v0.2.73 dbd0dfa

resize_unix.go RawHistoryFolder

1//go:build !windows
2
3package tui
4
5import (
6	"os"
7	"os/signal"
8	"syscall"
9	"time"
10
11	"golang.org/x/sys/unix"
12)
13
14func (p *ProcTerm) installResizeHandler() {
15	ch := make(chan os.Signal, 1)
16	signal.Notify(ch, syscall.SIGWINCH)
17	go func() {
18		for range ch {
19			for _, cb := range p.resizeCBs {
20				cb()
21			}
22		}
23	}()
24}
25
26func (p *ProcTerm) SetNonblock(enable bool) error {
27	return syscall.SetNonblock(int(p.in.Fd()), enable)
28}
29
30// peekStdin polls the stdin fd for up to d; if a byte is ready, reads
31// and returns it. Returns (0, false, nil) on timeout.
32//
33// Uses golang.org/x/sys/unix so the syscall signatures line up on both
34// linux (syscall.Select returns (int, error), Timeval.Usec is int64)
35// and darwin (Select returns error only, Timeval.Usec is int32) —
36// pulling this through the x/sys wrappers makes both builds happy.
37func peekStdin(in *os.File, d time.Duration) (byte, bool, error) {
38	fd := int(in.Fd())
39	var rset unix.FdSet
40	rset.Set(fd)
41	tv := unix.NsecToTimeval(int64(d))
42	_, err := unix.Select(fd+1, &rset, nil, nil, &tv)
43	if err != nil {
44		if err == unix.EINTR {
45			return 0, false, nil
46		}
47		return 0, false, err
48	}
49	if !rset.IsSet(fd) {
50		return 0, false, nil
51	}
52	var b [1]byte
53	_, rerr := in.Read(b[:])
54	if rerr != nil {
55		return 0, false, rerr
56	}
57	return b[0], true, nil
58}

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