From 5c373094cc4bdae566f7bcef2bbfc82c792a17f1 Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Wed, 5 Apr 2023 20:39:05 +0600 Subject: [PATCH] Fix resizing when alternative display is enabled * eat.el (eat--t-term): Fix error while resizing when alternative display is enabled. --- eat.el | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/eat.el b/eat.el index 621e914..baa46ba 100644 --- a/eat.el +++ b/eat.el @@ -3369,16 +3369,19 @@ is the selection data encoded in base64." (< height old-height)) ;; Go to the beginning of display. (goto-char (eat--t-disp-begin disp)) - (dotimes (l height) - (eat--t-col-motion width) - (delete-region (point) (car (eat--t-eol))) - (if (< (1+ l) height) - (forward-char) - (delete-region (point) (point-max)) - (let ((y (eat--t-cur-y cursor)) - (x (eat--t-cur-x cursor))) - (eat--t-goto 1 1) - (eat--t-goto y x))))) + (let ((l 0)) + (while (and (< l height) (not (eobp))) + (eat--t-col-motion width) + (delete-region (point) (car (eat--t-eol))) + (unless (eobp) + (if (< (1+ l) height) + (forward-char) + (delete-region (point) (point-max)) + (let ((y (eat--t-cur-y cursor)) + (x (eat--t-cur-x cursor))) + (eat--t-goto 1 1) + (eat--t-goto y x)))) + (cl-incf l)))) ;; REVIEW: This works, but it is very simple. Most ;; terminals have more sophisticated mechanisms to do this. ;; It would be nice thing have them here.