From 35c5422dc2e3451abfc3f3debadcb69dabb77c23 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Sun, 24 Sep 2017 13:33:03 +0100 Subject: [PATCH] Goto to parent on left arrow in tree with single column --- scene/gui/tree.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 1aaea987983..464d87de71f 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2135,8 +2135,15 @@ void Tree::_gui_input(Ref p_event) { if (selected_item->get_children() != NULL && !selected_item->is_collapsed()) { selected_item->set_collapsed(true); } else { - selected_col = columns.size() - 1; - dobreak = false; // fall through to key_up + if (columns.size() == 1) { // goto parent with one column + TreeItem *parent = selected_item->get_parent(); + if (selected_item != get_root() && parent && parent->is_selectable(selected_col) && !(hide_root && parent == get_root())) { + select_single_item(parent, get_root(), selected_col); + } + } else { + selected_col = columns.size() - 1; + dobreak = false; // fall through to key_up + } } } else { if (select_mode == SELECT_MULTI) { @@ -2149,6 +2156,7 @@ void Tree::_gui_input(Ref p_event) { } update(); accept_event(); + ensure_cursor_is_visible(); if (dobreak) { break;