aboutsummaryrefslogtreecommitdiff
path: root/src/guiTable.cpp
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2015-10-18 10:42:44 +0200
committerKahrl <kahrl@gmx.net>2015-10-18 10:42:44 +0200
commitba9d7215ecc38b6a33e2984a600c13db203f6274 (patch)
tree56b59e36edf093afa201dd01e6a457c38b84fe0d /src/guiTable.cpp
parent6b0cae5a9d6e220b9f1ecf8e6a821d84961564fd (diff)
downloadminetest-ba9d7215ecc38b6a33e2984a600c13db203f6274.tar.gz
minetest-ba9d7215ecc38b6a33e2984a600c13db203f6274.tar.bz2
minetest-ba9d7215ecc38b6a33e2984a600c13db203f6274.zip
Settings tab: don't autoscroll when toggling "Show technical names"
Diffstat (limited to 'src/guiTable.cpp')
-rw-r--r--src/guiTable.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/guiTable.cpp b/src/guiTable.cpp
index b327782e2..8e8144af8 100644
--- a/src/guiTable.cpp
+++ b/src/guiTable.cpp
@@ -556,6 +556,8 @@ s32 GUITable::getSelected() const
void GUITable::setSelected(s32 index)
{
+ s32 old_selected = m_selected;
+
m_selected = -1;
m_sel_column = 0;
m_sel_doubleclick = false;
@@ -572,7 +574,8 @@ void GUITable::setSelected(s32 index)
}
// If the selected row is not visible, open its ancestors to make it visible
- if (m_rows[index].visible_index < 0) {
+ bool selection_invisible = m_rows[index].visible_index < 0;
+ if (selection_invisible) {
std::set<s32> opened_trees;
getOpenedTrees(opened_trees);
s32 indent = m_rows[index].indent;
@@ -590,7 +593,9 @@ void GUITable::setSelected(s32 index)
assert(m_selected >= 0 && m_selected < (s32) m_visible_rows.size());
}
- autoScroll();
+ if (m_selected != old_selected || selection_invisible) {
+ autoScroll();
+ }
}
GUITable::DynamicData GUITable::getDynamicData() const