detached 46fa06b

fix(tui): remove obsolete OSC helpers

commit
46fa06b4d6f99d9ad017fcde74943641e791e28f
author
brice · · 2026-08-05 09:15 UTC
parent
6435059
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +0 -71
M packages/tui/detect_bg.go +0 -71
@@ -229,74 +229,3 @@ func parseTerminalRGB(value string) (TerminalColor, bool) {
229229 }
230230 return ColorRGB(channels[0], channels[1], channels[2]), true
231231 }
232-
233-// readOSCResponse drains stdin into a small buffer until either a terminator
234-// (BEL or ST) is seen, the deadline expires, or stdin hits EOF. It remains a
235-// small helper for callers that only need one OSC reply.
236-func readOSCResponse(deadline time.Time) string {
237- var buf [128]byte
238- n := 0
239- for time.Now().Before(deadline) {
240- remaining := time.Until(deadline)
241- if remaining <= 0 {
242- break
243- }
244- b, ok, err := peekStdin(os.Stdin, remaining)
245- if err != nil || !ok {
246- return string(buf[:n])
247- }
248- if n < len(buf) {
249- buf[n] = b
250- n++
251- }
252- if b == 0x07 {
253- return string(buf[:n])
254- }
255- if n >= 2 && buf[n-2] == 0x1b && buf[n-1] == '\\' {
256- return string(buf[:n])
257- }
258- }
259- return string(buf[:n])
260-}
261-
262-// parseOSC11Reply extracts the (r, g, b) colour components from an OSC 11
263-// reply of the form "\\x1b]11;rgb:RRRR/GGGG/BBBB\\x07" (or with ST
264-// terminator). The component widths can be 1, 2, 3, or 4 hex digits per
265-// channel; we normalise them into the 0..1 range.
266-func parseOSC11Reply(s string) (float64, float64, float64, bool) {
267- i := strings.Index(s, "rgb:")
268- if i < 0 {
269- return 0, 0, 0, false
270- }
271- body := strings.TrimRight(s[i+len("rgb:"):], "\x07")
272- body = strings.TrimSuffix(body, "\x1b\\")
273- parts := strings.Split(body, "/")
274- if len(parts) != 3 {
275- return 0, 0, 0, false
276- }
277- parse := func(hexstr string) (float64, bool) {
278- if len(hexstr) == 0 || len(hexstr) > 4 {
279- return 0, false
280- }
281- v, err := strconv.ParseUint(hexstr, 16, 32)
282- if err != nil {
283- return 0, false
284- }
285- max := uint64(1)
286- for range hexstr {
287- max *= 16
288- }
289- max--
290- if max == 0 {
291- return 0, false
292- }
293- return float64(v) / float64(max), true
294- }
295- r, ok1 := parse(parts[0])
296- g, ok2 := parse(parts[1])
297- b, ok3 := parse(parts[2])
298- if !ok1 || !ok2 || !ok3 {
299- return 0, 0, 0, false
300- }
301- return r, g, b, true
302-}
@@ -229,74 +229,3 @@ func parseTerminalRGB(value string) (TerminalColor, bool) {
229 }229 }
230 return ColorRGB(channels[0], channels[1], channels[2]), true230 return ColorRGB(channels[0], channels[1], channels[2]), true
231 }231 }
232-
233-// readOSCResponse drains stdin into a small buffer until either a terminator
234-// (BEL or ST) is seen, the deadline expires, or stdin hits EOF. It remains a
235-// small helper for callers that only need one OSC reply.
236-func readOSCResponse(deadline time.Time) string {
237- var buf [128]byte
238- n := 0
239- for time.Now().Before(deadline) {
240- remaining := time.Until(deadline)
241- if remaining <= 0 {
242- break
243- }
244- b, ok, err := peekStdin(os.Stdin, remaining)
245- if err != nil || !ok {
246- return string(buf[:n])
247- }
248- if n < len(buf) {
249- buf[n] = b
250- n++
251- }
252- if b == 0x07 {
253- return string(buf[:n])
254- }
255- if n >= 2 && buf[n-2] == 0x1b && buf[n-1] == '\\' {
256- return string(buf[:n])
257- }
258- }
259- return string(buf[:n])
260-}
261-
262-// parseOSC11Reply extracts the (r, g, b) colour components from an OSC 11
263-// reply of the form "\\x1b]11;rgb:RRRR/GGGG/BBBB\\x07" (or with ST
264-// terminator). The component widths can be 1, 2, 3, or 4 hex digits per
265-// channel; we normalise them into the 0..1 range.
266-func parseOSC11Reply(s string) (float64, float64, float64, bool) {
267- i := strings.Index(s, "rgb:")
268- if i < 0 {
269- return 0, 0, 0, false
270- }
271- body := strings.TrimRight(s[i+len("rgb:"):], "\x07")
272- body = strings.TrimSuffix(body, "\x1b\\")
273- parts := strings.Split(body, "/")
274- if len(parts) != 3 {
275- return 0, 0, 0, false
276- }
277- parse := func(hexstr string) (float64, bool) {
278- if len(hexstr) == 0 || len(hexstr) > 4 {
279- return 0, false
280- }
281- v, err := strconv.ParseUint(hexstr, 16, 32)
282- if err != nil {
283- return 0, false
284- }
285- max := uint64(1)
286- for range hexstr {
287- max *= 16
288- }
289- max--
290- if max == 0 {
291- return 0, false
292- }
293- return float64(v) / float64(max), true
294- }
295- r, ok1 := parse(parts[0])
296- g, ok2 := parse(parts[1])
297- b, ok3 := parse(parts[2])
298- if !ok1 || !ok2 || !ok3 {
299- return 0, 0, 0, false
300- }
301- return r, g, b, true
302-}

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