diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-20 15:29:33 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-20 15:29:33 -0400 |
| commit | dbee95ae877a3bf0d38bfd78891c3c2c9c576519 (patch) | |
| tree | c58d84bee2ebb13ab41c739824ae53ad3ffbc300 /tests/test-cj-window-geometry-lib.el | |
| parent | 9f281489ecdcc762ee07833d47144dcfd2939dfe (diff) | |
| download | dotemacs-dbee95ae877a3bf0d38bfd78891c3c2c9c576519.tar.gz dotemacs-dbee95ae877a3bf0d38bfd78891c3c2c9c576519.zip | |
fix(ai-term): stop F9 toggle shrinking the agent window each cycle
The F9 toggle captured the agent window's body-height and replayed it as
body-lines. Body-height subtracts the mode line's pixel height, which differs
between an active and an inactive mode line; the agent is captured active but
redisplayed inactive, so under a theme whose mode-line-inactive is shorter than
a text line the window lost ~1 line per toggle.
Capture and replay total-height for the vertical axis instead, via the renamed
cj/window-replay-size. Total-height is identical active or inactive and has no
mode-line-pixel dependence, so the round-trip is a fixed point. Width keeps
body-width (total-width has the position-dependent divider problem that total-
height does not). The shared lib fix covers the F12 terminal toggle too.
The shrink only manifests in a GUI frame, so it is not reproducible in the
batch harness; the unit tests pin the new total-height contract.
Diffstat (limited to 'tests/test-cj-window-geometry-lib.el')
| -rw-r--r-- | tests/test-cj-window-geometry-lib.el | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/test-cj-window-geometry-lib.el b/tests/test-cj-window-geometry-lib.el index 938749f21..d32a48a92 100644 --- a/tests/test-cj-window-geometry-lib.el +++ b/tests/test-cj-window-geometry-lib.el @@ -2,7 +2,7 @@ ;;; Commentary: ;; Tests the pure helpers in `cj-window-geometry-lib.el': -;; `cj/window-direction', `cj/window-body-size', +;; `cj/window-direction', `cj/window-replay-size', ;; `cj/cardinal-to-edge-direction', and `cj/window-at-edge'. ;;; Code: @@ -52,30 +52,32 @@ (delete-other-windows) (should (eq (cj/window-direction (selected-window) 'below) 'below)))) -(ert-deftest test-cj-window-geometry--body-size-right-returns-body-cols () +(ert-deftest test-cj-window-geometry--replay-size-right-returns-body-cols () "Normal: right window with direction='right -> body-width in cols." (save-window-excursion (delete-other-windows) (let ((right (split-window (selected-window) nil 'right))) - (should (= (cj/window-body-size right 'right) + (should (= (cj/window-replay-size right 'right) (window-body-width right)))))) -(ert-deftest test-cj-window-geometry--body-size-below-returns-body-lines () - "Normal: below window with direction='below -> body-height in lines." +(ert-deftest test-cj-window-geometry--replay-size-below-returns-total-lines () + "Normal: below window with direction='below -> total-height in lines. +The vertical axis captures total-height (not body-height) so the capture/ +replay round-trip is immune to the mode line's pixel height." (save-window-excursion (delete-other-windows) (let ((below (split-window (selected-window) nil 'below))) - (should (= (cj/window-body-size below 'below) - (window-body-height below)))))) + (should (= (cj/window-replay-size below 'below) + (window-total-height below)))))) -(ert-deftest test-cj-window-geometry--body-size-narrow-window () +(ert-deftest test-cj-window-geometry--replay-size-narrow-window () "Normal: deliberately narrow right window -> matching body cols." (save-window-excursion (delete-other-windows) (let* ((frame-w (frame-width)) (target-cols (/ frame-w 4)) (right (split-window (selected-window) (- target-cols) 'right))) - (should (= (cj/window-body-size right 'right) + (should (= (cj/window-replay-size right 'right) (window-body-width right)))))) (ert-deftest test-cj-window-geometry--cardinal-to-edge-right () |
