v0.3.0 cf370a0

fullscreen_left_core_test.go RawHistoryFolder

1package core
2
3import (
4	"context"
5	"testing"
6	"time"
7
8	"github.com/bnema/neferwl/internal/ports"
9)
10
11// Through core, scroll overflow: an app whose fullscreen the user left by
12// activating another window cannot cover it again by asking at once; once
13// activated again, it may ask and is honoured.
14func TestCoreLeftFullscreenLatch(t *testing.T) {
15	client := make(chan ports.ClientEvent)
16	output := make(chan ports.OutputEvent)
17	commands := make(chan ports.ClientCommand, 64)
18	scenes := make(chan []ports.Scene, 1)
19	cfg := ports.Config{}
20	cfg.Keyboard.CmdKey = "super"
21	cfg.Layout.MaxColumns = 2
22	c, err := New(cfg, Channels{Client: client, Output: output, Commands: commands, Scenes: scenes, Clock: laterClock(t)})
23	if err != nil {
24		t.Fatal(err)
25	}
26	ctx, cancel := context.WithCancel(context.Background())
27	defer cancel()
28	done := make(chan struct{})
29	go func() { defer close(done); _ = c.Run(ctx) }()
30	go func() {
31		for range commands {
32		}
33	}()
34	full := func() ports.WindowID {
35		t.Helper()
36		select {
37		case s := <-scenes:
38			for _, w := range s[0].Windows {
39				if w.Fullscreen && !w.Hidden {
40					return w.ID
41				}
42			}
43			return 0
44		case <-time.After(time.Second):
45			t.Fatal("scene timeout")
46			return 0
47		}
48	}
49	output <- ports.OutputAdded{Info: ports.OutputInfo{Name: "OUT-1", Width: 100, Height: 80}}
50	full()
51	client <- ports.WindowMapped{ID: 1}
52	full()
53	client <- ports.WindowMapped{ID: 2}
54	full()
55	client <- ports.WindowFullscreenRequest{ID: 2, Fullscreen: true}
56	if id := full(); id != 2 {
57		t.Fatalf("fullscreen %d, want 2", id)
58	}
59	client <- ports.WindowActivate{ID: 1}
60	if id := full(); id != 0 {
61		t.Fatalf("after activation: fullscreen %d", id)
62	}
63	client <- ports.WindowFullscreenRequest{ID: 2, Fullscreen: true}
64	if id := full(); id != 0 {
65		t.Fatalf("re-request covered: fullscreen %d", id)
66	}
67	client <- ports.WindowActivate{ID: 2}
68	full()
69	client <- ports.WindowActivate{ID: 1}
70	full()
71	// The latch settled when 2 had the focus: scroll overflow honours an
72	// unfocused window's request again.
73	client <- ports.WindowFullscreenRequest{ID: 2, Fullscreen: true}
74	if id := full(); id != 2 {
75		t.Fatalf("after refocus: fullscreen %d, want 2", id)
76	}
77	cancel()
78	<-done
79	close(commands)
80}

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 25

Tags 10

↑↓ moveenter openesc close