From dec1ad5d928012df0596cbd990acc28a04b8d1e9 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 31 Dec 2020 11:07:47 +0000 Subject: [PATCH] Revert "Fixed limits and Urls bugs" This reverts commit 6d9c1d27a1b33c6837ff2abe9fa1e5c7c9a90df7. --- src/Screen.cpp | 42 ++++++++++++++---------------------------- src/Screen.h | 4 ---- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/src/Screen.cpp b/src/Screen.cpp index 3719089c..f2fc7fe3 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -388,8 +388,10 @@ void Screen::resizeImage(int new_lines, int new_columns) if ((new_lines == _lines) && (new_columns == _columns)) { return; } + // set min values of columns and lines here + new_columns = (17 < new_columns)? new_columns : 17; // FIXME: bug when column <= 16 + new_lines = (3 < new_lines)? new_lines : 3; // FIXME: bug when lines <= 2 - // Adjust scroll position, and fix glitches _oldTotalLines = getLines() + getHistLines(); _isResize = true; @@ -427,7 +429,11 @@ void Screen::resizeImage(int new_lines, int new_columns) } // Check if it need to move from _screenLine to _history while (_cuY > new_lines - 1) { - fastAddHistLine(); + _history->addCellsVector(_screenLines[0]); + _history->addLine((_lineProperties[0] & LINE_WRAPPED) != 0); + _screenLines.pop_front(); + _lineProperties.remove(0); + _cuY--; } _lineProperties.resize(new_lines + 1); _screenLines.resize(new_lines + 1); @@ -436,10 +442,13 @@ void Screen::resizeImage(int new_lines, int new_columns) if (new_columns != _columns && _history->getLines()) { // Join next line from _screenLine to _history while (_history->isWrappedLine(_history->getLines() - 1)) { - fastAddHistLine(); + _history->addCellsVector(_screenLines[0]); + _history->addLine((_lineProperties[0] & LINE_WRAPPED) != 0); + _screenLines.pop_front(); + _lineProperties.remove(0); + _cuY--; } currentPos = 0; - // Join everything in _history while (currentPos < _history->getLines() - 1) { // if it's true, join the line with next line if (_history->isWrappedLine(currentPos)) { @@ -460,14 +469,13 @@ void Screen::resizeImage(int new_lines, int new_columns) } currentPos++; } - // Now move data to next line if needed + // Move data to next line if needed currentPos = 0; while (currentPos < _history->getLines()) { int curr_linelen = _history->getLineLen(currentPos); // if the current line > new_columns it will need a new line if (curr_linelen > new_columns) { - bool removeLine = _history->getLines() == _history->getMaxLines(); auto *curr_line = getCharacterBuffer(curr_linelen); bool curr_line_property = _history->isWrappedLine(currentPos); _history->getCells(currentPos, 0, curr_linelen, curr_line); @@ -481,11 +489,6 @@ void Screen::resizeImage(int new_lines, int new_columns) _history->addCells(curr_line + new_columns, curr_linelen - new_columns); _history->addLine(curr_line_property); } - // If _history size > max history size it will drop a line from _history. - // We need to verify if we need to remove a URL. - if (removeLine) { - _escapeSequenceUrlExtractor->historyLinesRemoved(1); - } } currentPos++; } @@ -1569,23 +1572,6 @@ void Screen::writeLinesToStream(TerminalCharacterDecoder* decoder, int fromLine, writeToStream(decoder, loc(0, fromLine), loc(_columns - 1, toLine), PreserveLineBreaks); } -void Screen::fastAddHistLine() -{ - bool removeLine = _history->getLines() == _history->getMaxLines(); - _history->addCellsVector(_screenLines[0]); - _history->addLine((_lineProperties[0] & LINE_WRAPPED) != 0); - - // If _history size > max history size it will drop a line from _history. - // We need to verify if we need to remove a URL. - if (removeLine) { - _escapeSequenceUrlExtractor->historyLinesRemoved(1); - } - - _screenLines.pop_front(); - _lineProperties.remove(0); - _cuY--; -} - void Screen::addHistLine() { // add line to history buffer diff --git a/src/Screen.h b/src/Screen.h index a794f0bd..cf523711 100644 --- a/src/Screen.h +++ b/src/Screen.h @@ -588,9 +588,7 @@ public: static const Character DefaultChar; - // Return the total number of lines before resize (fix scroll glitch) int getOldTotalLines(); - // Return if it was a resize signal (fix scroll glitch) bool isResize(); private: @@ -628,8 +626,6 @@ private: TerminalDisplay *_currentTerminalDisplay; void addHistLine(); - // add lines from _screen to _history and remove from _screen the added lines (used to resize lines and columns) - void fastAddHistLine(); void initTabStops();