refactor(daemon): drop unused copy targeting params
- commit
- a0541a8dd1b27ea4ad6dd009c686bdbfdd405a3e
- author
- brice · · 2026-07-10 07:51 UTC
- parent
- 50dce66
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +8 -8
M internal/usecase/daemon/copymode_test.go +5 -5
| @@ -642,7 +642,7 @@ func TestCursorTailHidesInCopyMode(t *testing.T) { | |||
| 642 | 642 | require.Contains(t, string(data), "\x1b[?25l") | |
| 643 | 643 | } | |
| 644 | 644 | ||
| 645 | - | func installFloatingCopyFixture(t *testing.T, d *Daemon, sess *session, size domain.Size) *pane { | |
| 645 | + | func installFloatingCopyFixture(t *testing.T, sess *session, size domain.Size) *pane { | |
| 646 | 646 | t.Helper() | |
| 647 | 647 | floatingPTY, releaseFloating := newBlockingPTY(t) | |
| 648 | 648 | t.Cleanup(releaseFloating) | |
| @@ -675,7 +675,7 @@ func TestCopyModeCapturesSourceAndRetainsItAcrossFocusMove(t *testing.T) { | |||
| 675 | 675 | main := tb.focusedPane() | |
| 676 | 676 | var want *pane | |
| 677 | 677 | if tc.useFloating { | |
| 678 | - | want = installFloatingCopyFixture(t, d, sess, domain.Size{Cols: 20, Rows: 3}) | |
| 678 | + | want = installFloatingCopyFixture(t, sess, domain.Size{Cols: 20, Rows: 3}) | |
| 679 | 679 | want.scrollback.Append(testRow("flt-old")) | |
| 680 | 680 | want.screen.Write([]byte("flt-live")) | |
| 681 | 681 | } else { | |
| @@ -715,7 +715,7 @@ func TestFloatingCopyModeWheelUsesCapturedSnapshot(t *testing.T) { | |||
| 715 | 715 | normal, releaseNormal := newBlockingPTY(t) | |
| 716 | 716 | defer releaseNormal() | |
| 717 | 717 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | |
| 718 | - | fp := installFloatingCopyFixture(t, d, sess, domain.Size{Cols: 20, Rows: 3}) | |
| 718 | + | fp := installFloatingCopyFixture(t, sess, domain.Size{Cols: 20, Rows: 3}) | |
| 719 | 719 | for i := range 30 { | |
| 720 | 720 | fp.scrollback.Append(testRow(fmt.Sprintf("old-%02d", i))) | |
| 721 | 721 | } | |
| @@ -741,7 +741,7 @@ func TestFloatingCopyModeMouseSelectsFloatingRows(t *testing.T) { | |||
| 741 | 741 | normal, releaseNormal := newBlockingPTY(t) | |
| 742 | 742 | defer releaseNormal() | |
| 743 | 743 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | |
| 744 | - | fp := installFloatingCopyFixture(t, d, sess, domain.Size{Cols: 20, Rows: 3}) | |
| 744 | + | fp := installFloatingCopyFixture(t, sess, domain.Size{Cols: 20, Rows: 3}) | |
| 745 | 745 | for i := range 5 { | |
| 746 | 746 | fp.scrollback.Append(testRow(fmt.Sprintf("old-%d", i))) | |
| 747 | 747 | } | |
| @@ -773,7 +773,7 @@ func TestFloatingExitClearsCopyModeBeforeRepaint(t *testing.T) { | |||
| 773 | 773 | defer releaseNormal() | |
| 774 | 774 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | |
| 775 | 775 | tb := sess.activeTab() | |
| 776 | - | fp := installFloatingCopyFixture(t, d, sess, domain.Size{Cols: 20, Rows: 3}) | |
| 776 | + | fp := installFloatingCopyFixture(t, sess, domain.Size{Cols: 20, Rows: 3}) | |
| 777 | 777 | fp.screen.Write([]byte("flt-live")) | |
| 778 | 778 | ||
| 779 | 779 | d.enterCopyMode(sess, ac) | |
| @@ -642,7 +642,7 @@ func TestCursorTailHidesInCopyMode(t *testing.T) { | |||||
| 642 | require.Contains(t, string(data), "\x1b[?25l") | 642 | require.Contains(t, string(data), "\x1b[?25l") | ||
| 643 | } | 643 | } | ||
| 644 | 644 | ||||
| 645 | - | func installFloatingCopyFixture(t *testing.T, d *Daemon, sess *session, size domain.Size) *pane { | 645 | + | func installFloatingCopyFixture(t *testing.T, sess *session, size domain.Size) *pane { |
| 646 | t.Helper() | 646 | t.Helper() | ||
| 647 | floatingPTY, releaseFloating := newBlockingPTY(t) | 647 | floatingPTY, releaseFloating := newBlockingPTY(t) | ||
| 648 | t.Cleanup(releaseFloating) | 648 | t.Cleanup(releaseFloating) | ||
| @@ -675,7 +675,7 @@ func TestCopyModeCapturesSourceAndRetainsItAcrossFocusMove(t *testing.T) { | |||||
| 675 | main := tb.focusedPane() | 675 | main := tb.focusedPane() | ||
| 676 | var want *pane | 676 | var want *pane | ||
| 677 | if tc.useFloating { | 677 | if tc.useFloating { | ||
| 678 | - | want = installFloatingCopyFixture(t, d, sess, domain.Size{Cols: 20, Rows: 3}) | 678 | + | want = installFloatingCopyFixture(t, sess, domain.Size{Cols: 20, Rows: 3}) |
| 679 | want.scrollback.Append(testRow("flt-old")) | 679 | want.scrollback.Append(testRow("flt-old")) | ||
| 680 | want.screen.Write([]byte("flt-live")) | 680 | want.screen.Write([]byte("flt-live")) | ||
| 681 | } else { | 681 | } else { | ||
| @@ -715,7 +715,7 @@ func TestFloatingCopyModeWheelUsesCapturedSnapshot(t *testing.T) { | |||||
| 715 | normal, releaseNormal := newBlockingPTY(t) | 715 | normal, releaseNormal := newBlockingPTY(t) | ||
| 716 | defer releaseNormal() | 716 | defer releaseNormal() | ||
| 717 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | 717 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | ||
| 718 | - | fp := installFloatingCopyFixture(t, d, sess, domain.Size{Cols: 20, Rows: 3}) | 718 | + | fp := installFloatingCopyFixture(t, sess, domain.Size{Cols: 20, Rows: 3}) |
| 719 | for i := range 30 { | 719 | for i := range 30 { | ||
| 720 | fp.scrollback.Append(testRow(fmt.Sprintf("old-%02d", i))) | 720 | fp.scrollback.Append(testRow(fmt.Sprintf("old-%02d", i))) | ||
| 721 | } | 721 | } | ||
| @@ -741,7 +741,7 @@ func TestFloatingCopyModeMouseSelectsFloatingRows(t *testing.T) { | |||||
| 741 | normal, releaseNormal := newBlockingPTY(t) | 741 | normal, releaseNormal := newBlockingPTY(t) | ||
| 742 | defer releaseNormal() | 742 | defer releaseNormal() | ||
| 743 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | 743 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | ||
| 744 | - | fp := installFloatingCopyFixture(t, d, sess, domain.Size{Cols: 20, Rows: 3}) | 744 | + | fp := installFloatingCopyFixture(t, sess, domain.Size{Cols: 20, Rows: 3}) |
| 745 | for i := range 5 { | 745 | for i := range 5 { | ||
| 746 | fp.scrollback.Append(testRow(fmt.Sprintf("old-%d", i))) | 746 | fp.scrollback.Append(testRow(fmt.Sprintf("old-%d", i))) | ||
| 747 | } | 747 | } | ||
| @@ -773,7 +773,7 @@ func TestFloatingExitClearsCopyModeBeforeRepaint(t *testing.T) { | |||||
| 773 | defer releaseNormal() | 773 | defer releaseNormal() | ||
| 774 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | 774 | d, sess, ac, sends := newManualSessionWithPTYs(t, normal) | ||
| 775 | tb := sess.activeTab() | 775 | tb := sess.activeTab() | ||
| 776 | - | fp := installFloatingCopyFixture(t, d, sess, domain.Size{Cols: 20, Rows: 3}) | 776 | + | fp := installFloatingCopyFixture(t, sess, domain.Size{Cols: 20, Rows: 3}) |
| 777 | fp.screen.Write([]byte("flt-live")) | 777 | fp.screen.Write([]byte("flt-live")) | ||
| 778 | 778 | ||||
| 779 | d.enterCopyMode(sess, ac) | 779 | d.enterCopyMode(sess, ac) | ||
M internal/usecase/daemon/render.go +2 -2
| @@ -278,7 +278,7 @@ func (d *Daemon) render(sess *session, tb *tab, p *pane) { | |||
| 278 | 278 | // copyTargetRectLocked maps a captured copy source into the already-composed | |
| 279 | 279 | // client frame. The caller holds tb.mu, preserving the layout/floating | |
| 280 | 280 | // snapshot while the rectangle is chosen. | |
| 281 | - | func copyTargetRectLocked(tb *tab, layoutSnap tabLayoutSnapshot, contentArea domain.Rect, p, floating *pane, hasFloating bool, cfg domain.FloatingConfig) domain.Rect { | |
| 281 | + | func copyTargetRectLocked(layoutSnap tabLayoutSnapshot, contentArea domain.Rect, p, floating *pane, hasFloating bool, cfg domain.FloatingConfig) domain.Rect { | |
| 282 | 282 | if p == nil { | |
| 283 | 283 | return domain.Rect{} | |
| 284 | 284 | } | |
| @@ -400,7 +400,7 @@ func (d *Daemon) paint(sess *session, ac *attachedClient, reset bool) { | |||
| 400 | 400 | if copyPane == nil { | |
| 401 | 401 | copyPane = p | |
| 402 | 402 | } | |
| 403 | - | copyTarget := copyTargetRectLocked(tb, layoutSnap, contentArea, copyPane, floating, hasFloating, d.currentFloatingConfig()) | |
| 403 | + | copyTarget := copyTargetRectLocked(layoutSnap, contentArea, copyPane, floating, hasFloating, d.currentFloatingConfig()) | |
| 404 | 404 | frame, damage = composeCopyClientFrame(overlays.copyMode, copyPane, copyTarget, frame, bars) | |
| 405 | 405 | } | |
| 406 | 406 | // A palette above normal/copy content dims that composed content. When a | |
| @@ -278,7 +278,7 @@ func (d *Daemon) render(sess *session, tb *tab, p *pane) { | |||||
| 278 | // copyTargetRectLocked maps a captured copy source into the already-composed | 278 | // copyTargetRectLocked maps a captured copy source into the already-composed | ||
| 279 | // client frame. The caller holds tb.mu, preserving the layout/floating | 279 | // client frame. The caller holds tb.mu, preserving the layout/floating | ||
| 280 | // snapshot while the rectangle is chosen. | 280 | // snapshot while the rectangle is chosen. | ||
| 281 | - | func copyTargetRectLocked(tb *tab, layoutSnap tabLayoutSnapshot, contentArea domain.Rect, p, floating *pane, hasFloating bool, cfg domain.FloatingConfig) domain.Rect { | 281 | + | func copyTargetRectLocked(layoutSnap tabLayoutSnapshot, contentArea domain.Rect, p, floating *pane, hasFloating bool, cfg domain.FloatingConfig) domain.Rect { |
| 282 | if p == nil { | 282 | if p == nil { | ||
| 283 | return domain.Rect{} | 283 | return domain.Rect{} | ||
| 284 | } | 284 | } | ||
| @@ -400,7 +400,7 @@ func (d *Daemon) paint(sess *session, ac *attachedClient, reset bool) { | |||||
| 400 | if copyPane == nil { | 400 | if copyPane == nil { | ||
| 401 | copyPane = p | 401 | copyPane = p | ||
| 402 | } | 402 | } | ||
| 403 | - | copyTarget := copyTargetRectLocked(tb, layoutSnap, contentArea, copyPane, floating, hasFloating, d.currentFloatingConfig()) | 403 | + | copyTarget := copyTargetRectLocked(layoutSnap, contentArea, copyPane, floating, hasFloating, d.currentFloatingConfig()) |
| 404 | frame, damage = composeCopyClientFrame(overlays.copyMode, copyPane, copyTarget, frame, bars) | 404 | frame, damage = composeCopyClientFrame(overlays.copyMode, copyPane, copyTarget, frame, bars) | ||
| 405 | } | 405 | } | ||
| 406 | // A palette above normal/copy content dims that composed content. When a | 406 | // A palette above normal/copy content dims that composed content. When a | ||
M internal/usecase/daemon/render_test.go +1 -1
| @@ -1474,7 +1474,7 @@ func TestCopyTargetRectLocked(t *testing.T) { | |||
| 1474 | 1474 | } | |
| 1475 | 1475 | for _, tc := range cases { | |
| 1476 | 1476 | t.Run(tc.name, func(t *testing.T) { | |
| 1477 | - | require.Equal(t, tc.want, copyTargetRectLocked(tb, layoutSnap, contentArea, tc.pane, tc.floating, tc.hasFloating, cfg)) | |
| 1477 | + | require.Equal(t, tc.want, copyTargetRectLocked(layoutSnap, contentArea, tc.pane, tc.floating, tc.hasFloating, cfg)) | |
| 1478 | 1478 | }) | |
| 1479 | 1479 | } | |
| 1480 | 1480 | } | |
| @@ -1474,7 +1474,7 @@ func TestCopyTargetRectLocked(t *testing.T) { | |||||
| 1474 | } | 1474 | } | ||
| 1475 | for _, tc := range cases { | 1475 | for _, tc := range cases { | ||
| 1476 | t.Run(tc.name, func(t *testing.T) { | 1476 | t.Run(tc.name, func(t *testing.T) { | ||
| 1477 | - | require.Equal(t, tc.want, copyTargetRectLocked(tb, layoutSnap, contentArea, tc.pane, tc.floating, tc.hasFloating, cfg)) | 1477 | + | require.Equal(t, tc.want, copyTargetRectLocked(layoutSnap, contentArea, tc.pane, tc.floating, tc.hasFloating, cfg)) |
| 1478 | }) | 1478 | }) | ||
| 1479 | } | 1479 | } | ||
| 1480 | } | 1480 | } | ||