From 733e78587f4fb9ea88de652dff7f841573923f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Javier=20Merino=20Mor=C3=A1n?= Date: Thu, 21 Oct 2021 19:02:21 +0200 Subject: [PATCH] Respect DECDWL/DHL on last column cursor controls --- src/Screen.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Screen.cpp b/src/Screen.cpp index 327f2674..30205650 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -96,7 +96,7 @@ void Screen::cursorUp(int n) n = 1; // Default } const int stop = _cuY < _topMargin ? 0 : _topMargin; - _cuX = qMin(_columns - 1, _cuX); // nowrap! + _cuX = qMin(getScreenLineColumns(_cuY) - 1, _cuX); // nowrap! _cuY = qMax(stop, _cuY - n); } @@ -110,7 +110,7 @@ void Screen::cursorDown(int n) n = MAX_SCREEN_ARGUMENT; } const int stop = _cuY > _bottomMargin ? _lines - 1 : _bottomMargin; - _cuX = qMin(_columns - 1, _cuX); // nowrap! + _cuX = qMin(getScreenLineColumns(_cuY) - 1, _cuX); // nowrap! _cuY = qMin(stop, _cuY + n); } @@ -120,7 +120,7 @@ void Screen::cursorLeft(int n) if (n < 1) { n = 1; // Default } - _cuX = qMin(_columns - 1, _cuX); // nowrap! + _cuX = qMin(getScreenLineColumns(_cuY) - 1, _cuX); // nowrap! _cuX = qMax(0, _cuX - n); } @@ -771,7 +771,7 @@ void Screen::reset() void Screen::backspace() { - _cuX = qMin(_columns - 1, _cuX); // nowrap! + _cuX = qMin(getScreenLineColumns(_cuY) - 1, _cuX); // nowrap! _cuX = qMax(0, _cuX - 1); if (_screenLines.at(_cuY).size() < _cuX + 1) {