]> git.eshelyaron.com Git - emacs.git/commit
Fix setting and resetting of scroll-with-delete
authorJohn Shahid <jvshahid@gmail.com>
Mon, 29 Apr 2019 17:53:38 +0000 (13:53 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 7 May 2019 18:51:42 +0000 (14:51 -0400)
commite44b56d16ad0749e599700a73509c16391ed973e
tree30fa77764767cdd4a954d94383c703db0f1dac9d
parent32cf07819ae8cfdbf14e00f351c7f520fff325c3
Fix setting and resetting of scroll-with-delete

The start and end lines of the scroll region must to be in the range
[0,term-height).  There are few placees that incorrectly set the end
line of the scroll region to term-height which is outside the valid
range.  Combined with another off-by-one error in
term-set-scroll-region's clamping logic, this would cause
term-scroll-with-delete to be unnecessarily turned on.

* lisp/term.el (term-scroll-start,term-scroll-end): Use defvar-local
to define the variables and document the valid range of values that
the variables can take.
(term--last-line): New function to calculate the 0-based index of the
last line.
(term--reset-scroll-region): New function to reset the scroll region
to the full height of the terminal.
(term-mode,term-reset-size,term-reset-terminal): Call
term--reset-scroll-region to reset the scroll region.
(term-set-scroll-region): Fix the off-by-one error in the clamping
logic which allowed term-scroll-end to have values outside the valid
range [0,term-height).
lisp/term.el
test/lisp/term-tests.el