Commit 06c20103 authored by thrust26's avatar thrust26
Browse files

fixed crash in StringListwidget when scrolling with mouse

fixed #398
parent b8e53d76
......@@ -58,6 +58,7 @@ class ListWidget : public EditableWidget
const string& getSelectedString() const;
void scrollTo(int item);
void scrollToEnd() { scrollToCurrent(int(_list.size())); }
// Account for the extra width of embedded scrollbar
int getWidth() const override;
......
......@@ -89,6 +89,7 @@ void LoggerDialog::loadConfig()
StringParser parser(instance().logMessages());
myLogInfo->setList(parser.stringList());
myLogInfo->setSelected(0);
myLogInfo->scrollToEnd();
myLogLevel->setSelected(instance().settings().getString("loglevel"), "1");
myLogToConsole->setState(instance().settings().getBool("logtoconsole"));
......
......@@ -104,7 +104,7 @@ void StringListWidget::drawWidget(bool hilite)
GUI::Rect StringListWidget::getEditRect() const
{
GUI::Rect r(2, 1, _w - 2, _fontHeight);
const int offset = (_selectedItem - _currentPos) * _fontHeight;
const int offset = std::max(0, (_selectedItem - _currentPos) * _fontHeight);
r.top += offset;
r.bottom += offset;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment