hterm: vt scroll clear when region is full screen Revert back to clearing top and bottom regions when scroll region is set to the full height of the screen as the function docs describe. Bug introduced in crrev.com/c/2315460 Bug: 1094783 Change-Id: Ifc7db4d845c9424e06077c38ed5505d4d68fd5cb Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/2406012 Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> (cherry picked from commit 4337eac2b8731a0c7c235e8c62532cae6edfe241) Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/2406014 Tested-by: Joel Hockey <joelhockey@chromium.org>
diff --git a/hterm/js/hterm_terminal.js b/hterm/js/hterm_terminal.js index 19a6af3..3e4c902 100644 --- a/hterm/js/hterm_terminal.js +++ b/hterm/js/hterm_terminal.js
@@ -2229,8 +2229,13 @@ */ hterm.Terminal.prototype.setVTScrollRegion = function(scrollTop, scrollBottom) { this.vtScrollTop_ = scrollTop; - this.vtScrollBottom_ = - scrollBottom == this.screenSize.height - 1 ? null : scrollBottom; + this.vtScrollBottom_ = scrollBottom; + if (scrollBottom == this.screenSize.height - 1) { + this.vtScrollBottom_ = null; + if (scrollTop == 0) { + this.vtScrollTop_ = null; + } + } }; /**
diff --git a/hterm/js/hterm_vt_tests.js b/hterm/js/hterm_vt_tests.js index 1333b5f..e54e497 100644 --- a/hterm/js/hterm_vt_tests.js +++ b/hterm/js/hterm_vt_tests.js
@@ -3457,13 +3457,13 @@ assert.isNull(terminal.vtScrollTop_); assert.isNull(terminal.vtScrollBottom_); this.terminal.interpret('\x1b[1r'); - assert.equal(terminal.vtScrollTop_, 0); + assert.isNull(terminal.vtScrollTop_); assert.isNull(terminal.vtScrollBottom_); this.terminal.interpret('\x1b[1;5r'); assert.equal(terminal.vtScrollTop_, 0); assert.equal(terminal.vtScrollBottom_, 4); this.terminal.interpret('\x1b[1;6r'); - assert.equal(terminal.vtScrollTop_, 0); + assert.isNull(terminal.vtScrollTop_); assert.isNull(terminal.vtScrollBottom_); // Reset.