[Scummvm-git-logs] scummvm master -> 8d363cf46588728a031b6c932180f0a7f4909991

bluegr noreply at scummvm.org
Wed Mar 25 10:20:32 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
8d363cf465 GUI: Fix ListWidget SHIFT+UP multi-selection


Commit: 8d363cf46588728a031b6c932180f0a7f4909991
    https://github.com/scummvm/scummvm/commit/8d363cf46588728a031b6c932180f0a7f4909991
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2026-03-25T12:20:27+02:00

Commit Message:
GUI: Fix ListWidget SHIFT+UP multi-selection

SHIFT+UP after starting ScummVM or after removing a game would cause
the visual selection and the internal selection to be out of sync.

The problem was that ListWidget::_lastSelectionStartItem was only
initialized on certain code paths. Now it is initialized when marking
an item as selected, if it isn't already.

Fixes bug #16635

Changed paths:
    gui/widgets/groupedlist.cpp
    gui/widgets/list.cpp


diff --git a/gui/widgets/groupedlist.cpp b/gui/widgets/groupedlist.cpp
index 56c0f673811..58b74926836 100644
--- a/gui/widgets/groupedlist.cpp
+++ b/gui/widgets/groupedlist.cpp
@@ -252,7 +252,6 @@ void GroupedListWidget::handleMouseDown(int x, int y, int button, int clickCount
 		clearSelection();
 		_selectedItem = newSelectedItem;
 		markSelectedItem(newSelectedItem, true);
-		_lastSelectionStartItem = newSelectedItem;
 		sendCommand(kListSelectionChangedCmd, _selectedItem);
 	}
 
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 5895477f26d..b9362f7059a 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -224,6 +224,11 @@ bool ListWidget::isItemSelected(int item) const {
 }
 
 void ListWidget::markSelectedItem(int item, bool state) {
+	// Initialize _lastSelectionStartItem if not already set
+	if (state && _lastSelectionStartItem == -1) {
+		_lastSelectionStartItem = item;
+	}
+
 	// Convert to actual item index if filtering is active
 	int actualItem = item;
 	if (!_listIndex.empty() && item >= 0 && item < (int)_listIndex.size()) {
@@ -376,7 +381,6 @@ void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 		clearSelection();
 		_selectedItem = newSelectedItem;
 		markSelectedItem(newSelectedItem, true);
-		_lastSelectionStartItem = newSelectedItem;
 		sendCommand(kListSelectionChangedCmd, _selectedItem);
 	}
 
@@ -603,7 +607,6 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 					}
 					// If dead end, restore the previous selection
 					markSelectedItem(_selectedItem, true);
-					_lastSelectionStartItem = _selectedItem;
 				}
 				if (_selectedItem < (int)_list.size() && !isItemVisible(_selectedItem))
 					scrollToCurrent();
@@ -684,7 +687,6 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
 					}
 					// If dead end, restore the previous selection
 					markSelectedItem(_selectedItem, true);
-					_lastSelectionStartItem = _selectedItem;
 				}
 				if (_selectedItem >= 0 && !isItemVisible(_selectedItem))
 					scrollToCurrent();




More information about the Scummvm-git-logs mailing list