detached 7e3cc95

fix(core): drop a taken column's windows from the switcher's recent use

commit
7e3cc95388061833f1c2eea9d44d8d7ce7465010
author
brice · · 2026-10-08 20:27 UTC
parent
6282944
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
refs
fix/v0.7.0-review
3 files · +15 -1
M internal/core/layout.go +2 -0
@@ -1046,6 +1046,8 @@ func (w *Workspace) takeColumn() (Column, bool) {
10461046 if slices.Contains(col.Windows, w.left) {
10471047 w.left = 0
10481048 }
1049+ // Its windows leave this workspace's recent use with it.
1050+ w.recent = slices.DeleteFunc(w.recent, func(v WindowID) bool { return slices.Contains(col.Windows, v) })
10491051 w.Columns = slices.Delete(w.Columns, w.Focus, w.Focus+1)
10501052 w.Focus = min(w.Focus, max(len(w.Columns)-1, 0))
10511053 if len(w.Columns) == 0 {
@@ -1046,6 +1046,8 @@ func (w *Workspace) takeColumn() (Column, bool) {
1046 if slices.Contains(col.Windows, w.left) {1046 if slices.Contains(col.Windows, w.left) {
1047 w.left = 01047 w.left = 0
1048 }1048 }
1049+ // Its windows leave this workspace's recent use with it.
1050+ w.recent = slices.DeleteFunc(w.recent, func(v WindowID) bool { return slices.Contains(col.Windows, v) })
1049 w.Columns = slices.Delete(w.Columns, w.Focus, w.Focus+1)1051 w.Columns = slices.Delete(w.Columns, w.Focus, w.Focus+1)
1050 w.Focus = min(w.Focus, max(len(w.Columns)-1, 0))1052 w.Focus = min(w.Focus, max(len(w.Columns)-1, 0))
1051 if len(w.Columns) == 0 {1053 if len(w.Columns) == 0 {
M internal/core/switcher.go +1 -1
@@ -51,7 +51,7 @@ func (w *Workspace) noteFocus() {
5151 }
5252 col := w.Columns[w.Focus]
5353 id := col.Windows[col.Focus]
54- if len(w.recent) > 0 && w.columnOf(w.recent[0]) == w.Focus {
54+ if len(w.recent) > 0 && slices.Contains(col.Windows, w.recent[0]) {
5555 w.recent[0] = id
5656 return
5757 }
@@ -51,7 +51,7 @@ func (w *Workspace) noteFocus() {
51 }51 }
52 col := w.Columns[w.Focus]52 col := w.Columns[w.Focus]
53 id := col.Windows[col.Focus]53 id := col.Windows[col.Focus]
54- if len(w.recent) > 0 && w.columnOf(w.recent[0]) == w.Focus {54+ if len(w.recent) > 0 && slices.Contains(col.Windows, w.recent[0]) {
55 w.recent[0] = id55 w.recent[0] = id
56 return56 return
57 }57 }
M internal/core/switcher_test.go +12 -0
@@ -60,6 +60,18 @@ func TestMRUOrder(t *testing.T) {
6060 w.MoveColumn(1)
6161 w.noteFocus()
6262 }, []WindowID{2, 3, 1}},
63+ {"a column taken to another workspace leaves recent", func(w *Workspace) {
64+ focusNote(w, 1)
65+ focusNote(w, 3)
66+ focusNote(w, 2)
67+ if _, ok := w.takeColumn(); !ok {
68+ t.Fatal("no column taken")
69+ }
70+ if slices.Contains(w.recent, 2) {
71+ t.Fatalf("recent %v keeps the taken window", w.recent)
72+ }
73+ w.noteFocus()
74+ }, []WindowID{3, 1}},
6375 }
6476 for _, tt := range tests {
6577 t.Run(tt.name, func(t *testing.T) {
@@ -60,6 +60,18 @@ func TestMRUOrder(t *testing.T) {
60 w.MoveColumn(1)60 w.MoveColumn(1)
61 w.noteFocus()61 w.noteFocus()
62 }, []WindowID{2, 3, 1}},62 }, []WindowID{2, 3, 1}},
63+ {"a column taken to another workspace leaves recent", func(w *Workspace) {
64+ focusNote(w, 1)
65+ focusNote(w, 3)
66+ focusNote(w, 2)
67+ if _, ok := w.takeColumn(); !ok {
68+ t.Fatal("no column taken")
69+ }
70+ if slices.Contains(w.recent, 2) {
71+ t.Fatalf("recent %v keeps the taken window", w.recent)
72+ }
73+ w.noteFocus()
74+ }, []WindowID{3, 1}},
63 }75 }
64 for _, tt := range tests {76 for _, tt := range tests {
65 t.Run(tt.name, func(t *testing.T) {77 t.Run(tt.name, func(t *testing.T) {

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 23

Tags 10

↑↓ moveenter openesc close