Skip to content

Commit ba9d721

Browse files
committedOct 18, 2015
Settings tab: don't autoscroll when toggling "Show technical names"
1 parent 6b0cae5 commit ba9d721

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎src/guiTable.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@ s32 GUITable::getSelected() const
556556

557557
void GUITable::setSelected(s32 index)
558558
{
559+
s32 old_selected = m_selected;
560+
559561
m_selected = -1;
560562
m_sel_column = 0;
561563
m_sel_doubleclick = false;
@@ -572,7 +574,8 @@ void GUITable::setSelected(s32 index)
572574
}
573575

574576
// If the selected row is not visible, open its ancestors to make it visible
575-
if (m_rows[index].visible_index < 0) {
577+
bool selection_invisible = m_rows[index].visible_index < 0;
578+
if (selection_invisible) {
576579
std::set<s32> opened_trees;
577580
getOpenedTrees(opened_trees);
578581
s32 indent = m_rows[index].indent;
@@ -590,7 +593,9 @@ void GUITable::setSelected(s32 index)
590593
assert(m_selected >= 0 && m_selected < (s32) m_visible_rows.size());
591594
}
592595

593-
autoScroll();
596+
if (m_selected != old_selected || selection_invisible) {
597+
autoScroll();
598+
}
594599
}
595600

596601
GUITable::DynamicData GUITable::getDynamicData() const

0 commit comments

Comments
 (0)
Please sign in to comment.