Tools__NavigationHistory.st
branchjv
changeset 15844 024b2d99744a
parent 15566 184cea584be5
child 16304 1685d6f9384e
--- a/Tools__NavigationHistory.st	Fri Sep 04 06:42:45 2015 +0100
+++ b/Tools__NavigationHistory.st	Fri Sep 04 07:28:33 2015 +0100
@@ -327,26 +327,24 @@
 goTo: navigationHistoryItem
     | idx |
 
-    idx := items indexOf:navigationHistoryItem.
+    idx := items lastIndexOf:navigationHistoryItem.
+    "/ do not uodate history if we go twice in a row into a same item...
+    (idx ~~ 0 and:[ idx == position ]) ifTrue:[ ^ self ].
+
     isGlobalHistory ifTrue:[
         idx ~~ 0 ifTrue:[
             items removeIndex:idx.
         ].
         self addFirst:navigationHistoryItem.
     ] ifFalse:[
-        idx ~~ 0 ifTrue: [
-            "/ already in list
-            position := idx
+        position < items size ifTrue:[
+            items removeFromIndex: position + 1 toIndex: items size
+        ].
+        items addLast: navigationHistoryItem.
+        items size > maxNumberOfItems ifTrue:[
+            items removeFirst
         ] ifFalse:[
-            position < items size ifTrue:[
-                items removeFromIndex: position + 1 toIndex: items size
-            ].
-            items addLast: navigationHistoryItem.
-            items size > maxNumberOfItems ifTrue:[
-                items removeFirst
-            ] ifFalse:[
-                position := position + 1
-            ].
+            position := position + 1
         ].
     ].
 
@@ -357,6 +355,7 @@
     "Created: / 21-02-2008 / 16:40:39 / janfrog"
     "Modified: / 21-02-2008 / 19:12:35 / janfrog"
     "Modified: / 03-07-2011 / 16:03:11 / cg"
+    "Modified (comment): / 04-09-2015 / 07:24:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !NavigationHistory methodsFor:'queries'!
@@ -388,6 +387,11 @@
     ^ '$Header: /cvs/stx/stx/libtool/Tools__NavigationHistory.st,v 1.17 2014-03-17 14:03:20 cg Exp $'
 !
 
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
     ^ '$Id: Tools__NavigationHistory.st,v 1.17 2014-03-17 14:03:20 cg Exp $'
 ! !