branch: externals/coterm
commit bab7d542c9bcccf27f28c1c6600ce190d007c526
Author: Miha Rihtaršič <[email protected]>
Commit: Miha Rihtaršič <[email protected]>

    Fix \e[1K and \e[0J if coterm--t-row-off is nonzero
---
 coterm.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/coterm.el b/coterm.el
index 1b8d4168d6..d4077b34ac 100644
--- a/coterm.el
+++ b/coterm.el
@@ -1168,7 +1168,8 @@ terminal screen."
                       ;; \E[J - clear to end of screen (terminfo: ed, clear)
                       ((and ?J (guard (eq 0 (car (ctl-params*)))))
                        (ins)
-                       (delete-region (point) (point-max)))
+                       (when (zerop coterm--t-row-off)
+                         (delete-region (point) (point-max))))
                       ((and ?J (guard (eq 1 (car (ctl-params*)))))
                        (ins)
                        (let ((opoint (point))
@@ -1203,10 +1204,16 @@ terminal screen."
                       ;; \E[K - clear to end of line (terminfo: el, el1)
                       ((and ?K (guard (eq 1 (car (ctl-params*)))))
                        (ins)
-                       (let ((ocol (coterm--t-col)))
-                         (delete-region (point) (progn (forward-line 0) 
(point)))
-                         (unless (eolp)
-                           (coterm--t-insert proc-filt process (make-string 
ocol ?\s) 0))))
+                       (and
+                        (not (bolp))
+                        (zerop coterm--t-row-off)
+                        (let ((ocol (coterm--t-col)))
+                          (delete-region (point) (progn (forward-line 0) 
(point)))
+                          (if (eolp)
+                              (setq coterm--t-col-off ocol)
+                            (coterm--t-apply-proc-filt
+                             proc-filt process (make-string ocol ?\s))
+                            (setq coterm--t-col-off 0)))))
                       ((and ?K (guard (eobp)))
                        (pass-through))
                       (?K

Reply via email to