1
0
Fork 0

GUI: fixed a bug with selection not automatically scrolling when needed

This commit is contained in:
Mr. eXoDia 2015-07-13 04:48:54 +02:00
parent 7bca96d616
commit 43554d4db6
1 changed files with 8 additions and 0 deletions

View File

@ -40,7 +40,15 @@ void SourceView::setSelection(int line)
{
int offset = line - 1;
if(isValidIndex(offset, 0))
{
int rangefrom = getTableOffset();
int rangeto = rangefrom + getViewableRowsCount() - 1;
if(offset < rangefrom) //ip lays before the current view
setTableOffset(offset);
else if(offset > (rangeto - 1)) //ip lays after the current view
setTableOffset(offset - getViewableRowsCount() + 2);
setSingleSelection(offset);
}
reloadData(); //repaint
}