aboutsummaryrefslogtreecommitdiff
path: root/modules/vterm-config.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-27 20:48:12 -0500
committerCraig Jennings <c@cjennings.net>2026-05-27 20:48:12 -0500
commit7833fb8bc0e3f9ece01ab2fe6fe07ded0efc4af4 (patch)
tree28234f51c546258fa57d40fe02bf0d30280182f1 /modules/vterm-config.el
parent822e7a3798d431910eeff677ae751eff8b48731a (diff)
downloaddotemacs-7833fb8bc0e3f9ece01ab2fe6fe07ded0efc4af4.tar.gz
dotemacs-7833fb8bc0e3f9ece01ab2fe6fe07ded0efc4af4.zip
fix(vterm): never reopen the F9/F12 windows from the top
F9 brought the agent window down from the top of the frame. The toggle remembers where the window last sat and replays it, and "above" was a position it could capture and replay: move the window to the top with the buffer-move keys, toggle off, and the next toggle reopened it up there. The host default never picks the top, so a remembered "above" was the only way in. I added an optional allowed-directions list to cj/window-toggle-capture-state, the helper both F9 (ai-vterm) and F12 (vterm-config) share. When the captured direction isn't in the list, it falls back to the default direction and clears the saved size, since that size was measured on the disallowed axis and wouldn't transfer. Both dispatchers now pass (right below left), so neither can remember a top placement. They go through the same helper, so the rule stays in one place. Three tests cover the new branch: a permitted direction is kept, a disallowed one falls back with the size cleared, and an omitted list preserves the old unconstrained behavior so existing callers are unaffected.
Diffstat (limited to 'modules/vterm-config.el')
-rw-r--r--modules/vterm-config.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/vterm-config.el b/modules/vterm-config.el
index e7965c65..c8a57d30 100644
--- a/modules/vterm-config.el
+++ b/modules/vterm-config.el
@@ -341,8 +341,10 @@ Used as the size fallback when `cj/--vterm-toggle-last-size' is nil
(defvar cj/--vterm-toggle-last-direction nil
"Last user-chosen direction for the F12 vterm display.
-Symbol: right, left, below, above. nil means use the default
-`below' for F12's traditional bottom split.")
+Symbol: right, left, or below. `above' is never stored -- a top
+placement falls back to `below' at capture time, so F12 never reopens
+from the top. nil means use the default `below' for F12's traditional
+bottom split.")
(defvar cj/--vterm-toggle-last-size nil
"Last user-chosen body size for the F12 vterm display.
@@ -384,7 +386,8 @@ split when WINDOW fills the frame's root area."
(cj/window-toggle-capture-state
window 'below
'cj/--vterm-toggle-last-direction
- 'cj/--vterm-toggle-last-size))
+ 'cj/--vterm-toggle-last-size
+ '(right below left)))
(defun cj/--vterm-toggle-display-saved (buffer alist)
"Display-buffer action: split per saved direction and body size.