commit 4ff69231df2670c8f880311b1e94d7f394094805
Author: Scott Kostyshak <skost...@lyx.org>
Date:   Wed Mar 26 01:19:52 2025 +0100

    Select branch after renaming it
    
    After renaming it, the best guess is that the user wants to perform
    another operation on the same item.
---
 src/frontends/qt/GuiBranches.cpp | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/frontends/qt/GuiBranches.cpp b/src/frontends/qt/GuiBranches.cpp
index 8f67ebb8bb..5b1eadcc39 100644
--- a/src/frontends/qt/GuiBranches.cpp
+++ b/src/frontends/qt/GuiBranches.cpp
@@ -262,12 +262,19 @@ void GuiBranches::on_renamePB_pressed()
                        newBranchLE->clear();
                        updateView();
 
-                       if (!success)
-                               Alert::error(_("Renaming failed"),
-                                     _("The branch could not be renamed."));
-                       else
+
+                       if (success) {
+                               // select newly renamed branch
+                               QList<QTreeWidgetItem *> const items_found = 
branchesTW->findItems(toqstr(newname), Qt::MatchExactly);
+                               LASSERT(items_found.size() == 1, return);
+                               branchesTW->setCurrentItem(items_found[0]);
+
                                // emit signal
                                renameBranches(oldname, newname);
+                       } else {
+                               Alert::error(_("Renaming failed"),
+                                     _("The branch could not be renamed."));
+                       }
                }
        }
 }
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to