changeset 71351:30e91c99f01a

(term-handle-scroll, term-delete-lines) (term-insert-lines): Fix off by one errors.
author Dan Nicolaescu <dann@ics.uci.edu>
date Thu, 15 Jun 2006 22:58:10 +0000
parents 0844ec8948e9
children 3b4c4b0d5eef
files lisp/ChangeLog lisp/term.el
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Jun 15 21:55:39 2006 +0000
+++ b/lisp/ChangeLog	Thu Jun 15 22:58:10 2006 +0000
@@ -1,3 +1,8 @@
+2006-06-15  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* term.el (term-handle-scroll, term-delete-lines)
+	(term-insert-lines): Fix off by one errors.
+
 2006-06-15  Katsumi Yamaoka  <yamaoka@jpl.org>  (tiny change)
 
 	* net/tramp.el (tramp-touch): Use UTC to express time.
--- a/lisp/term.el	Thu Jun 15 21:55:39 2006 +0000
+++ b/lisp/term.el	Thu Jun 15 22:58:10 2006 +0000
@@ -3613,7 +3613,7 @@
 		   (progn
 		     ;; Delete scroll-needed lines at term-scroll-end,
 		     ;; then insert scroll-needed lines.
-		     (term-vertical-motion (1- term-scroll-end))
+		     (term-vertical-motion term-scroll-end)
 		     (end-of-line)
 		     (setq save-top (point))
 		     (term-vertical-motion scroll-needed)
@@ -3767,11 +3767,12 @@
 	(save-current-column term-current-column)
 	(save-start-line-column term-start-line-column)
 	(save-current-row (term-current-row)))
-    (when (>= (+ save-current-row lines) term-scroll-end)
-	(setq lines (- lines (- (+ save-current-row lines) term-scroll-end))))
+    ;; The number of inserted lines shouldn't exceed the scroll region end.
+    (when (> (+ save-current-row lines) (1+ term-scroll-end))
+      (setq lines (- lines (- (+ save-current-row lines) (1+ term-scroll-end)))))
     (term-down lines)
     (delete-region start (point))
-    (term-down (- term-scroll-end save-current-row lines))
+    (term-down (- (1+ term-scroll-end) save-current-row lines))
     (term-insert-char ?\n lines)
     (setq term-current-column save-current-column)
     (setq term-start-line-column save-start-line-column)
@@ -3792,9 +3793,9 @@
 	  (term-down (- term-scroll-start save-current-row))
 	  (setq start (point)))
       ;; The number of inserted lines shouldn't exceed the scroll region end.
-      (when (>= (+ save-current-row lines) term-scroll-end)
-	(setq lines (- lines (- (+ save-current-row lines) term-scroll-end))))
-      (term-down (- term-scroll-end save-current-row lines)))
+      (when (> (+ save-current-row lines) (1+ term-scroll-end))
+	(setq lines (- lines (- (+ save-current-row lines)(1+ term-scroll-end)))))
+      (term-down (- (1+ term-scroll-end) save-current-row lines)))
     (setq start-deleted (point))
     (term-down lines)
     (delete-region start-deleted (point))