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;