detached d7ce2f4

fix(daemon): preserve pane rearrangement warnings

commit
d7ce2f4cb2f331be72806213d55fd28651856478
author
brice · · 2026-07-27 16:48 UTC
parent
950366c
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +37 -1
M internal/usecase/daemon/input.go +5 -1
@@ -302,7 +302,11 @@ func (h daemonKeyHandler) Action(action keys.Action) {
302302 if errors.Is(err, errDaemonActionNoChange) {
303303 return
304304 }
305- h.d.reportError(sess, resizeUserError(err))
305+ var userErr *domain.UserError
306+ if !errors.As(err, &userErr) {
307+ err = resizeUserError(err)
308+ }
309+ h.d.reportError(sess, err)
306310 return
307311 }
308312 if h.actions == nil {
@@ -302,7 +302,11 @@ func (h daemonKeyHandler) Action(action keys.Action) {
302 if errors.Is(err, errDaemonActionNoChange) {302 if errors.Is(err, errDaemonActionNoChange) {
303 return303 return
304 }304 }
305- h.d.reportError(sess, resizeUserError(err))305+ var userErr *domain.UserError
306+ if !errors.As(err, &userErr) {
307+ err = resizeUserError(err)
308+ }
309+ h.d.reportError(sess, err)
306 return310 return
307 }311 }
308 if h.actions == nil {312 if h.actions == nil {
M internal/usecase/daemon/input_test.go +32 -0
@@ -96,6 +96,38 @@ func TestConfiguredConsumeOrExpelEdgeActionIsSilent(t *testing.T) {
9696 requireNoInvalidation(t, invalidations)
9797 }
9898
99+func TestConsumeOrExpelKeyActionPreservesRearrangementWarning(t *testing.T) {
100+ tests := []struct {
101+ name string
102+ action keys.Action
103+ }{
104+ {name: "left", action: keys.ActionConsumeOrExpelPaneLeft},
105+ {name: "right", action: keys.ActionConsumeOrExpelPaneRight},
106+ }
107+
108+ for _, tt := range tests {
109+ t.Run(tt.name, func(t *testing.T) {
110+ d := newTestDaemon(t, nil, stubClock{})
111+ sess := addControlSession(d, "work", "t_work", "p_work")
112+ ac := &attachedClient{}
113+ ac.setSession(sess)
114+ runner := &actionRunnerSpy{err: domain.UserWarn(
115+ domain.NoticeLayoutTooSmall,
116+ "not enough space to rearrange pane",
117+ layout.ErrTooSmall,
118+ )}
119+
120+ daemonKeyHandler{d: d, ac: ac, actions: runner}.Action(tt.action)
121+
122+ history := d.notices.history()
123+ require.Len(t, history, 1)
124+ require.Equal(t, domain.NoticeLayoutTooSmall, history[0].Code)
125+ require.Equal(t, domain.NoticeWarn, history[0].Severity)
126+ require.Equal(t, "not enough space to rearrange pane", history[0].Message)
127+ })
128+ }
129+}
130+
99131 func TestResizeActionAdaptersSubmitEquivalentRequests(t *testing.T) {
100132 tests := []struct {
101133 name string
@@ -96,6 +96,38 @@ func TestConfiguredConsumeOrExpelEdgeActionIsSilent(t *testing.T) {
96 requireNoInvalidation(t, invalidations)96 requireNoInvalidation(t, invalidations)
97 }97 }
98 98
99+func TestConsumeOrExpelKeyActionPreservesRearrangementWarning(t *testing.T) {
100+ tests := []struct {
101+ name string
102+ action keys.Action
103+ }{
104+ {name: "left", action: keys.ActionConsumeOrExpelPaneLeft},
105+ {name: "right", action: keys.ActionConsumeOrExpelPaneRight},
106+ }
107+
108+ for _, tt := range tests {
109+ t.Run(tt.name, func(t *testing.T) {
110+ d := newTestDaemon(t, nil, stubClock{})
111+ sess := addControlSession(d, "work", "t_work", "p_work")
112+ ac := &attachedClient{}
113+ ac.setSession(sess)
114+ runner := &actionRunnerSpy{err: domain.UserWarn(
115+ domain.NoticeLayoutTooSmall,
116+ "not enough space to rearrange pane",
117+ layout.ErrTooSmall,
118+ )}
119+
120+ daemonKeyHandler{d: d, ac: ac, actions: runner}.Action(tt.action)
121+
122+ history := d.notices.history()
123+ require.Len(t, history, 1)
124+ require.Equal(t, domain.NoticeLayoutTooSmall, history[0].Code)
125+ require.Equal(t, domain.NoticeWarn, history[0].Severity)
126+ require.Equal(t, "not enough space to rearrange pane", history[0].Message)
127+ })
128+ }
129+}
130+
99 func TestResizeActionAdaptersSubmitEquivalentRequests(t *testing.T) {131 func TestResizeActionAdaptersSubmitEquivalentRequests(t *testing.T) {
100 tests := []struct {132 tests := []struct {
101 name string133 name string

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 12

Tags 11

↑↓ moveenter openesc close