GUI: fixed a bug with selection not automatically scrolling when needed
This commit is contained in:
parent
7bca96d616
commit
43554d4db6
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue