diff --git a/src/Screen.cpp b/src/Screen.cpp index 78d6df4b..00f1d63e 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -716,6 +716,17 @@ QVector Screen::getLineProperties(int startLine , int endLine) con return result; } +int Screen::getScreenLineColumns(const int line) const +{ + const int doubleWidthLine = _lineProperties[line] & LINE_DOUBLEWIDTH; + + if (doubleWidthLine) { + return _columns / 2; + } + + return _columns; +} + void Screen::reset() { // Clear screen, but preserve the current line @@ -891,12 +902,12 @@ void Screen::displayCharacter(uint c) return; } - if (_cuX + w > _columns) { + if (_cuX + w > getScreenLineColumns(_cuY)) { if (getMode(MODE_Wrap)) { _lineProperties[_cuY] = static_cast(_lineProperties[_cuY] | LINE_WRAPPED); nextLine(); } else { - _cuX = qMax(_columns - w, 0); + _cuX = qMax(getScreenLineColumns(_cuY) - w, 0); } } diff --git a/src/Screen.h b/src/Screen.h index f6052d4f..0927851d 100644 --- a/src/Screen.h +++ b/src/Screen.h @@ -666,6 +666,10 @@ private: int getLineLength(const int line) const; + // returns the width in columns of the specified screen line, + // taking DECDWL/DECDHL (double width/height modes) into account. + int getScreenLineColumns(const int line) const; + // screen image ---------------- int _lines; int _columns;