From dc780d8e25f597c9e64e3b68bb927a58d2eb5fd2 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Sun, 19 Mar 2023 10:46:21 +0100 Subject: [PATCH] added paging for PromptWidget output fixed disAsm of graphic bits --- src/debugger/gui/PromptWidget.cxx | 23 ++++++++++++++++++----- src/debugger/gui/PromptWidget.hxx | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index be0f3ab8f..f28bc5dda 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -61,6 +61,7 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font, _scrollBar = new ScrollBarWidget(boss, font, _x + _w, _y, ScrollBarWidget::scrollBarWidth(_font), _h); _scrollBar->setTarget(this); + _scrollStopLine = INT_MAX; clearScreen(); @@ -167,9 +168,17 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod) { case Event::EndEdit: { + if(_scrollLine < _currentPos / _lineWidth) + { + // Scroll page by page when not at cursor position: + _scrollLine += _linesPerPage; + if(_scrollLine > _promptEndPos / _lineWidth) + _scrollLine = _promptEndPos / _lineWidth; + updateScrollBuffer(); + break; + } if(execute()) return true; - printPrompt(); break; } @@ -798,7 +807,7 @@ void PromptWidget::nextLine() _inverse = false; const int line = _currentPos / _lineWidth; - if (line == _scrollLine) + if (line == _scrollLine && _scrollLine < _scrollStopLine) _scrollLine++; _currentPos = (line + 1) * _lineWidth; @@ -868,11 +877,12 @@ void PromptWidget::putcharIntern(int c) else if(c == 0x7f) { // toggle inverse video (DEL char) _inverse = !_inverse; } - else if(isprint(c)) + else if(isprint(c) || c == 0x1e || c == 0x1f) // graphic bits chars { buffer(_currentPos) = c | (_textcolor << 8) | (_inverse << 17); _currentPos++; - if ((_scrollLine + 1) * _lineWidth == _currentPos) + if ((_scrollLine + 1) * _lineWidth == _currentPos + && _scrollLine < _scrollStopLine) { _scrollLine++; updateScrollBuffer(); @@ -884,8 +894,11 @@ void PromptWidget::putcharIntern(int c) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PromptWidget::print(string_view str) { - for(const auto c: str) + // limit scolling of long text output + _scrollStopLine = _currentPos / _lineWidth + _linesPerPage - 1; + for(const auto c : str) putcharIntern(c); + _scrollStopLine = INT_MAX; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/PromptWidget.hxx b/src/debugger/gui/PromptWidget.hxx index 954da1ffe..cf10c2abb 100644 --- a/src/debugger/gui/PromptWidget.hxx +++ b/src/debugger/gui/PromptWidget.hxx @@ -115,6 +115,7 @@ class PromptWidget : public Widget, public CommandSender int _currentPos; int _scrollLine; int _firstLineInBuffer; + int _scrollStopLine; int _promptStartPos; int _promptEndPos;