feat/hints a471fa4

overview_configure_test.go RawHistoryFolder

1package core
2
3import (
4	"context"
5	"testing"
6
7	"github.com/bnema/neferwl/internal/ports"
8)
9
10// A neighbor workspace is visible only as an overview preview; its real
11// placement on the output is hidden. Its last configure must not be resized.
12func TestOverviewNeighborPreviewKeepsHiddenConfigureSize(t *testing.T) {
13	cfg := ports.Config{}
14	cfg.Keyboard.CmdKey = "super"
15	cfg.Layout.MaxColumns = 3
16	commands := make(chan ports.ClientCommand, 256)
17	scenes := make(chan []ports.Scene, 1)
18	c, err := New(cfg, Channels{Commands: commands, Scenes: scenes}, Options{})
19	if err != nil {
20		t.Fatal(err)
21	}
22	c.addScreen(ports.OutputInfo{Name: "OUT-1", Width: 600, Height: 400})
23	m := c.cur().mon
24	m.AddWindow(1)
25	m.Focus(1)
26	m.AddWindow(2)
27	ctx := context.Background()
28	publish := func() []ports.ConfigureWindow {
29		t.Helper()
30		if err := c.publish(ctx); err != nil {
31			t.Fatal(err)
32		}
33		<-scenes
34		var sent []ports.ConfigureWindow
35		for len(commands) > 0 {
36			if v, ok := (<-commands).(ports.ConfigureWindow); ok {
37				sent = append(sent, v)
38			}
39		}
40		return sent
41	}
42	publish() // establish a sized configure while workspace 2 is on screen
43	before := c.configures.sent[2]
44	if before.Width == 0 || before.Height == 0 {
45		t.Fatalf("missing prior size: %+v", before)
46	}
47	m.Focus(0)
48	publish() // the workspace is hidden on the output
49	if c.configures.sent[2].Visible {
50		t.Fatal("neighbor was not hidden before overview")
51	}
52	m.ToggleOverview()
53	preview := previewOf(t, m.Layout(), 2)
54	if preview.Hidden || preview.Preview <= 0 {
55		t.Fatalf("neighbor not shown as preview: %+v", preview)
56	}
57	for _, v := range publish() {
58		if v.ID == 2 && (v.Width != before.Width || v.Height != before.Height) {
59			t.Fatalf("hidden neighbor resized from %+v to %+v", before, v)
60		}
61	}
62	got := c.configures.sent[2]
63	if got.Width != before.Width || got.Height != before.Height {
64		t.Fatalf("neighbor size from %+v to %+v", before, got)
65	}
66}
67
68func TestOverviewConfigureUsesRealLayoutAfterMaximize(t *testing.T) {
69	cfg := ports.Config{}
70	cfg.Keyboard.CmdKey = "super"
71	cfg.Layout.Overflow = "fixed"
72	cfg.Layout.MaxColumns = 3
73	commands := make(chan ports.ClientCommand, 256)
74	scenes := make(chan []ports.Scene, 1)
75	c, err := New(cfg, Channels{Commands: commands, Scenes: scenes}, Options{})
76	if err != nil {
77		t.Fatal(err)
78	}
79	c.addScreen(ports.OutputInfo{Name: "OUT-1", Width: 600, Height: 400})
80	m := c.cur().mon
81	for id := WindowID(1); id <= 3; id++ {
82		m.AddWindow(id)
83	}
84	ctx := context.Background()
85	publish := func() []ports.ConfigureWindow {
86		t.Helper()
87		if err := c.publish(ctx); err != nil {
88			t.Fatal(err)
89		}
90		<-scenes
91		var out []ports.ConfigureWindow
92		for len(commands) > 0 {
93			if v, ok := (<-commands).(ports.ConfigureWindow); ok {
94				out = append(out, v)
95			}
96		}
97		return out
98	}
99	publish()
100	before := c.configures.sent[3]
101	m.ToggleOverview()
102	publish()
103	m.Current().ToggleFullWidth() // a real workspace mutation, not an overview bind
104	real := previewOf(t, m.Current().Layout(), 3)
105	expected := c.clientRect(real)
106	ps := m.Layout()
107	preview := previewOf(t, ps, 3)
108	if preview.Preview == 0 || expected.W <= before.Width {
109		t.Fatalf("setup before %+v expected %+v preview %+v", before, expected, preview)
110	}
111	got := publish()
112	found := false
113	for _, v := range got {
114		if v.ID == 3 {
115			found = true
116			if v.Width != expected.W || v.Height != expected.H {
117				t.Fatalf("preview sized configure %+v want %dx%d", v, expected.W, expected.H)
118			}
119		}
120	}
121	if !found {
122		t.Fatalf("no immediate resize while overview open; configures %v", got)
123	}
124}

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