[gnome-shell] history: Stop saving non-consecutive duplicate entries



commit 2b1f664aed5133f58112d4170b6190baec5a18a0
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Sat Sep 22 17:43:22 2018 +0200

    history: Stop saving non-consecutive duplicate entries
    
    Whenever a command runs in the run dialog, it
    will be added to the history unless it is
    already the last entry. This does not apply
    for entries that are not consecutive, which can
    result in long chains of commands which
    alternate, e.g. lg, r, lg, r, lg, r. Not only is
    this wasteful in terms of space, but also
    inconsistent with how history works elsewhere,
    e.g. in the shell.
    
    Therefore, remove entries in the history that are
    equal to the one that will be added to the end of
    of the history when the entry already exists.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/524

 js/misc/history.js | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/js/misc/history.js b/js/misc/history.js
index 693e6de1c..f1d037018 100644
--- a/js/misc/history.js
+++ b/js/misc/history.js
@@ -76,6 +76,7 @@ var HistoryManager = new Lang.Class({
         if (this._history.length == 0 ||
             this._history[this._history.length - 1] != input) {
 
+            this._history = this._history.filter(entry => entry != input);
             this._history.push(input);
             this._save();
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]