ZyX_I avatar ZyX_I committed da0ddfd

ftplugin/aurumlog: Made Prev/Next AuLog mappings use last found visible changeset
Made them work with loops like revision 0000... depending on itself

Comments (0)

Files changed (3)

ftplugin/aurumlog.vim

     let n=abs(a:n)
     let direction=((a:n>0)?('parents'):('children'))
     let tocheck=[]
+    let checked={}
+    let lastfoundhex=hex
     while n>0
         let tocheck+=repo.functions.getcsprop(repo, hex, direction)
         let prevn=n
         while !empty(tocheck)
             let hex=remove(tocheck, 0)
+            let checked[hex]=1
             if has_key(bvar.csstarts, hex)
                 let tocheck=[]
+                let lastfoundhex=hex
                 let n-=1
             else
-                let tocheck+=repo.functions.getcsprop(repo, hex, direction)
+                let tocheck+=filter(copy(
+                            \repo.functions.getcsprop(repo, hex, direction)),
+                            \'!has_key(checked, v:val)')
             endif
         endwhile
         if n==prevn
-            return ''
+            break
         endif
     endwhile
-    return "\<C-\>\<C-n>".(bvar.csstarts[hex]+1).'gg'
+    return "\<C-\>\<C-n>".(bvar.csstarts[lastfoundhex]+1).'gg'
 endfunction
 "▶1 next
 function s:F.next()
 2J:call WriteFile(getline('.'))
 K:call WriteFile(getline('.'))
 2K:call WriteFile(getline('.'))
+100J:call WriteFile(getline('.'))
 :source addmessages.vim
 :W{{{1 U
 /\VChangeset 4
 | | o  Changeset 6:9fe0c28c3e1dd175e8372b742f13cbb7bd6799fe (branch B)
 | o---+  Changeset 7:c06107b7bcbe751d2dd40faf4179ee7d6aac44ac (branch C)
 | o | |  Changeset 10:c4110a066208167dae46b08f4e0d8d2b37e842f3 (branch C)
+o  Changeset 0:99ea42d70fbe32af955de907352999b1d94bef5f
 {{{1 U
 @  Changeset 4:7e16e7cbaf9ec5b0e65832bc6f057ba825c38cac
 @  Changeset 3:a16a47a8d7aafc115651bfee6f1202093765365d
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.