From 83acfe03c215e3d20be7b40e2f4823ba4dfab23f Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Sat, 27 Jul 2019 11:45:50 +0200 Subject: [PATCH] fix #507 --- src/debugger/gui/RomListWidget.cxx | 8 ++++++-- src/debugger/gui/RomListWidget.hxx | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 8b0ea1ed4..48e6f35d3 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -170,8 +170,12 @@ void RomListWidget::setHighlighted(int item) _highlightedItem = item; // Only scroll the list if we're about to pass the page boundary - if(_currentPos == 0) - _currentPos = _highlightedItem; + if (_highlightedItem < _currentPos) + { + _currentPos -= _rows; + if (_currentPos < 0) + _currentPos = 0; + } else if(_highlightedItem == _currentPos + _rows) _currentPos += _rows; diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx index 58f1d4bc9..ac15b2ddd 100644 --- a/src/debugger/gui/RomListWidget.hxx +++ b/src/debugger/gui/RomListWidget.hxx @@ -94,7 +94,7 @@ class RomListWidget : public EditableWidget int _bytesWidth; int _rows; int _cols; - int _currentPos; + int _currentPos; // position of first line in visible window int _selectedItem; int _highlightedItem; bool _editMode;