diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-20 18:10:05 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-20 18:10:05 -0400 |
| commit | 21594eb78bf92016cc8fe172db162c1c45f8f463 (patch) | |
| tree | e0390bfa96ad10c038b9f43b9dee2f6f8d8d8a00 /tests/test-ai-vterm--display-rule.el | |
| parent | 09230b77c0d2bddc47801d2371fa26e9d96a8a1d (diff) | |
| download | dotemacs-21594eb78bf92016cc8fe172db162c1c45f8f463.tar.gz dotemacs-21594eb78bf92016cc8fe172db162c1c45f8f463.zip | |
feat(ai-vterm): default to bottom-75% on laptop, right-50% on desktop
The agent window's default placement was hardcoded to a right-side split at 50% width. That's wrong on a laptop, where the screen is shorter and a bottom split with more height fits better than a narrow side panel.
Pick the default from the host: bottom at 75% height on a laptop, right at 50% width on a desktop, branching on env-laptop-p in cj/--ai-vterm-default-direction and cj/--ai-vterm-default-size. The defaults still feed the existing toggle-capture mechanism, so re-orienting the window mid-session sticks the same way it did before.
Renamed cj/ai-vterm-window-width to cj/ai-vterm-desktop-width and added cj/ai-vterm-laptop-height so each axis has its own knob.
Diffstat (limited to 'tests/test-ai-vterm--display-rule.el')
| -rw-r--r-- | tests/test-ai-vterm--display-rule.el | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/test-ai-vterm--display-rule.el b/tests/test-ai-vterm--display-rule.el index 15d270e2..9b70134a 100644 --- a/tests/test-ai-vterm--display-rule.el +++ b/tests/test-ai-vterm--display-rule.el @@ -9,6 +9,7 @@ ;;; Code: (require 'ert) +(require 'cl-lib) (add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) (require 'ai-vterm) @@ -27,19 +28,22 @@ ,@body))) (ert-deftest test-ai-vterm--display-rule-routes-agent-buffer-to-right () - "Normal: a buffer named \"agent [foo]\" lands in a window to the right. + "Normal: on a desktop, \"agent [foo]\" lands in a window to the right. -The rule uses `display-buffer-in-direction' with `(direction . right)', -which splits the current window so the new window's left edge sits at -a positive column. The buffer winds up in that new window." +The desktop default direction is `right' (see +`cj/--ai-vterm-default-direction'), so the rule splits the current +window with `(direction . right)' and the new window's left edge +sits at a positive column. `env-laptop-p' is stubbed nil to pin the +desktop branch; on a laptop the agent would land below instead." (let ((name "agent [display-rule-test]")) (test-ai-vterm--cleanup name) (unwind-protect - (test-ai-vterm--with-clean-frame - (let* ((buf (get-buffer-create name)) - (win (display-buffer buf))) - (should (windowp win)) - (should (> (window-left-column win) 0)))) + (cl-letf (((symbol-function 'env-laptop-p) (lambda () nil))) + (test-ai-vterm--with-clean-frame + (let* ((buf (get-buffer-create name)) + (win (display-buffer buf))) + (should (windowp win)) + (should (> (window-left-column win) 0))))) (test-ai-vterm--cleanup name)))) (ert-deftest test-ai-vterm--display-rule-skips-non-matching-buffer () |
