commit ad6babc9ed62fb6f455045ebcfd50a2615731248
Author: Scott Kostyshak <skost...@lyx.org>
Date:   Fri Mar 21 12:11:47 2025 +0100

    Select a branch after rm a branch in doc settings
    
    Before, after pressing the "Remove" PB to remove a branch, there
    would be no subsequent branch selected. Now, if there is a branch
    below the one removed, it is selected; if not, if there is a branch
    above the one removed, it is selected.
    
    This is useful for removing multiple branches by clicking several
    times on the "Remove" PB.
---
 src/frontends/qt/GuiBranches.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/frontends/qt/GuiBranches.cpp b/src/frontends/qt/GuiBranches.cpp
index 795a6f6d6f..4fa4d09fc9 100644
--- a/src/frontends/qt/GuiBranches.cpp
+++ b/src/frontends/qt/GuiBranches.cpp
@@ -199,6 +199,17 @@ void GuiBranches::on_removePB_pressed()
        if (!sel_branch.isEmpty()) {
                branchlist_.remove(qstring_to_ucs4(sel_branch));
                newBranchLE->clear();
+
+               QTreeWidgetItem * newSelItem = branchesTW->itemBelow(selItem);
+               if (newSelItem != 0) {
+                       branchesTW->setCurrentItem(newSelItem);
+               } else {
+                       // no item below, so select item above if one exists.
+                       newSelItem = branchesTW->itemAbove(selItem);
+                       if (newSelItem != 0)
+                               branchesTW->setCurrentItem(newSelItem);
+               }
+
                updateView();
        }
 }
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to