From c1faca2b07ac86f84450bbb95ecb6d8635410281 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Tue, 17 Apr 2018 19:17:18 -0400 Subject: [PATCH] Don't assume term-current-row cache is valid (Bug#31193) * lisp/term.el (term-down): Call `term-current-row' instead of directly accessing the variable `term-current-row. Following a resize of the terminal's window, `term-current-row' is reset to nil, so it is not safe to assume it is a number. --- lisp/term.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/term.el b/lisp/term.el index 0a5efa4abc..6860ea6934 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -3764,7 +3764,7 @@ term-down (let ((start-column (term-horizontal-column))) (when (and check-for-scroll (or term-scroll-with-delete term-pager-count)) (setq down (term-handle-scroll down))) - (unless (and (= term-current-row 0) (< down 0)) + (unless (and (= (term-current-row) 0) (< down 0)) (term-adjust-current-row-cache down) (when (or (/= (point) (point-max)) (< down 0)) (setq down (- down (term-vertical-motion down))))) @@ -3774,7 +3774,7 @@ term-down (setq term-current-column 0) (setq term-start-line-column 0)) (t - (when (= term-current-row 0) + (when (= (term-current-row) 0) ;; Insert lines if at the beginning. (save-excursion (term-insert-char ?\n (- down))) (save-excursion -- 2.11.0