diff --git a/mistty-term.el b/mistty-term.el index a667d44..62f2c40 100644 --- a/mistty-term.el +++ b/mistty-term.el @@ -577,7 +577,12 @@ This function returns the newly-created buffer." (setq-local term-height height) (setq-local term-command-function #'mistty--term-command-hook) (mistty-term--exec program args) - (set-process-window-size (get-buffer-process term-buffer) height width) + (let ((proc (get-buffer-process term-buffer))) + ;; TRAMP sets adjust-window-size-function to #'ignore, which + ;; prevents normal terminal resizing from working. This turns + ;; it on again. + (process-put proc 'adjust-window-size-function nil) + (set-process-window-size proc height width)) (setq-local term-raw-map local-map) (term-char-mode) (advice-add 'move-to-column :around #'mistty--around-move-to-column) diff --git a/mistty.el b/mistty.el index eccf090..7f825fc 100644 --- a/mistty.el +++ b/mistty.el @@ -2741,6 +2741,7 @@ only spaces with ==\'mistty-skip t between them." window-adjust-process-window-size-function)) (size (funcall adjust-func mistty-proc (get-buffer-window-list mistty-work-buffer nil t)))) + (mistty-log "set-process-window-size %s" size) (when size (let ((width (- (car size) left-margin-width)) (height (cdr size))) diff --git a/test/mistty-tramp-test.el b/test/mistty-tramp-test.el index 48d1269..e818e86 100644 --- a/test/mistty-tramp-test.el +++ b/test/mistty-tramp-test.el @@ -137,3 +137,23 @@ (mistty--send-string mistty-proc "printf '\\032//home\\nok\\n'") (should (equal "ok" (mistty-send-and-capture-command-output))) (should (equal (concat sg-prefix "/home/") default-directory))))) + +(ert-deftest mistty-tramp-test-window-size () + (let* ((sg-prefix (mistty-test-sg-prefix)) + (home (file-name-directory "/")) + (default-directory (concat sg-prefix home))) + (mistty-with-test-buffer (:selected t) + (let ((win (selected-window)) + cols-before cols-after) + (mistty-send-text "tput cols") + (setq cols-before (string-to-number (mistty-send-and-capture-command-output))) + + (split-window-horizontally nil win) + (mistty--window-size-change win) + + ;; This makes sure the terminal is told about the window size + ;; change. + (mistty-send-text "tput cols") + (setq cols-after (string-to-number (mistty-send-and-capture-command-output))) + (should-not (equal cols-before cols-after)) + (should (< cols-after cols-before))))))