[gnome-shell] switcherPopup: Select correct item after removal of item
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] switcherPopup: Select correct item after removal of item
- Date: Wed, 26 Feb 2020 22:52:57 +0000 (UTC)
commit c00f1d040bbb6cd5449fda14ea0992914847c821
Author: Jonas Dreßler <verdre v0yd nl>
Date: Thu Apr 26 00:32:57 2018 +0200
switcherPopup: Select correct item after removal of item
If an item was removed, make sure the selected item is still selected or
select the last one if the selected item was removed.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/167
js/ui/switcherPopup.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index 49b99dd18c..5f2839cf2c 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -255,7 +255,15 @@ var SwitcherPopup = GObject.registerClass({
_itemRemovedHandler(n) {
if (this._items.length > 0) {
- let newIndex = Math.min(n, this._items.length - 1);
+ let newIndex;
+
+ if (n < this._selectedIndex)
+ newIndex = this._selectedIndex - 1;
+ else if (n === this._selectedIndex)
+ newIndex = Math.min(n, this._items.length - 1);
+ else if (n > this._selectedIndex)
+ return; // No need to select something new in this case
+
this._select(newIndex);
} else {
this.fadeAndDestroy();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]