From 717b615ab62c6c5a0c53df39e2c532b64c3f054e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Javier=20Merino=20Mor=C3=A1n?= Date: Thu, 30 Sep 2021 00:59:28 +0200 Subject: [PATCH] Cursor PreviousLine should respect the top margin From esctest: CPLTests.test_CPL_StopsAtTopMarginInScrollRegion --- src/Screen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Screen.cpp b/src/Screen.cpp index 9f51c9fc..8612016d 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -155,7 +155,8 @@ void Screen::cursorPreviousLine(int n) n = 1; // Default } _cuX = 0; - _cuY = qMax(0, _cuY - n); + const int stop = _cuY < _topMargin ? 0 : _topMargin; + _cuY = qMax(stop, _cuY - n); } void Screen::cursorRight(int n)