Эх сурвалжийг харах

[notebook] Maintain order in snippet wheel when adding snippets from history

Johan Ahlen 10 жил өмнө
parent
commit
95ee5eb

+ 5 - 6
desktop/core/src/desktop/templates/ko_components.mako

@@ -1002,13 +1002,12 @@ from desktop.views import _ko
             return;
           }
 
-          var currentIndex = self.snippetHistory().indexOf(alternative);
-          if (currentIndex > -1) {
-            self.snippetHistory().splice(currentIndex, 1);
-          } else if (self.snippetHistory().length == 5) {
-            self.snippetHistory.pop();
+          if (self.snippetHistory().indexOf(alternative) == -1) {
+            if (self.snippetHistory().length == 5) {
+              self.snippetHistory.pop();
+            }
+            self.snippetHistory.unshift(alternative);
           }
-          self.snippetHistory.unshift(alternative);
 
           self.notebook.newSnippet(alternative.type())
         };