Commits

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

  • Participants
  • Parent commits 119ca13

Comments (0)

Files changed (3)

File 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()

File test/logmaps.in

 2J:call WriteFile(getline('.'))
 K:call WriteFile(getline('.'))
 2K:call WriteFile(getline('.'))
+100J:call WriteFile(getline('.'))
 :source addmessages.vim
 :W{{{1 U
 /\VChangeset 4

File test/logmaps.ok

 | | 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