Commits

ZyX_I committed 97a75d3

Improved commits minimizing in graphlog (now they are not shown at all)

Comments (0)

Files changed (1)

ftplugin/aurumgraphlog.vim

 "▶2 glog.utf
 function s:F.glog.utf(state, type, char, text, coldata)
     let [idx, edges, ncols, coldiff]=a:coldata
-    let add_padding_line=[]
+    let add_padding_line=0
     let lnum=len(a:text.text)
     if coldiff==-1
         call s:F.glog.fix_long_right_edges(edges)
         if lnum>2
-            let add_padding_line=map(filter(copy(edges),
-                        \                   '(v:val[0]+1)<v:val[1]'),
-                        \            'v:val[0]')
+            let add_padding_line=!empty(map(filter(copy(edges),
+                        \                          '(v:val[0]+1)<v:val[1]'),
+                        \                   'v:val[0]'))
         endif
     endif
-    let fix_nodeline_tail = (lnum<=2 && empty(add_padding_line))
+    let fix_nodeline_tail = (lnum<=2 && add_padding_line)
     let shift_interline=repeat(['|', ' '], idx)
     let nodeline=copy(shift_interline)+
                 \[a:char, ' ']+
                 \        repeat([edge_ch, ' '], (ncols-idx-1))
     call s:F.glog.draw_edges(edges, nodeline, shift_interline)
     let lines=[nodeline]
-    if !empty(add_padding_line)
+    if add_padding_line
         call add(lines, s:F.glog.get_padding_line(idx, ncols, edges))
     endif
-    call add(lines, shift_interline)
+    if a:text.min
+        let joined_sil=join(shift_interline, '')
+        let joined_nl=substitute(join(nodeline, ''), '\V'.a:char, '|', '')
+        let a:text.text=[]
+        if joined_nl!~#'\v^[o| ]+$'
+            let a:text.text+=[substitute(joined_nl,'\v\-@<=\||\|\-@=','+','')]
+        endif
+        if joined_sil!~#'\v^[| ]+$' && joined_sil isnot# joined_nl
+            let a:text.text+=[joined_sil]
+        endif
+        return a:text
+    else
+        call add(lines, shift_interline)
+    endif
     let ltdiff=lnum-len(lines)
     if ltdiff>0
         let extra_interline=repeat(['|', ' '], ncols+coldiff)
 function s:F.glog.summary(cs, opts)
     let special={}
     let text=[]
-    let r={'text': text, 'special': special}
+    let r={'text': text, 'special': special, 'min': 0}
     "▶3 Add changeset (and, possibly, branch)
     let text+=['Changeset '.a:cs.rev.':'.a:cs.hex]
     let special.changeset_l=[0, 0]
                 \(has_key(a:opts, 'search') &&
                 \   a:cs.description!~#a:opts.search) ||
                 \(has_key(a:opts, 'user') && a:cs.user!~#a:opts.user)
+        let r.min=1
         return r
     endif
     if has_key(a:opts, 'date')
         endif
         call map(nums, 'len(v:val)==1 ? "0".v:val : v:val')
         if strftime('%d %m %Y %H %M')!~'\m^'.join(nums)
+            let r.min=1
             return r
         endif
     endif
         let text=call(a:Dumper, [cs, a:opts], {})
         call s:F.glog.utf(state, 'C', char, text,
                     \     s:F.glog.utfedges(seen, cs.hex, cs.parents))
-        let text.block_r[0][0]+=len(r.text)
-        let text.block_r[1][0]+=len(r.text)
+        if empty(text.text)
+            continue
+        endif
+        if !text.min
+            let text.block_r[0][0]+=len(r.text)
+            let text.block_r[1][0]+=len(r.text)
+            let r.specials[cs.hex]=text.special
+            let r.rectangles+=[text.block_r+[cs.hex]]
+        endif
         let r.text+=text.text
-        let r.specials[cs.hex]=text.special
-        let r.rectangles+=[text.block_r+[cs.hex]]
     endfor
     return r
 endfunction
     setlocal readonly
     call s:_f.augroup.add('AuGlog', [['InsertEnter', '<buffer='.buf.'>', 0,
                 \                     'call feedkeys("\e", "n")']])
-    " FIXME
-    let b:bvar=bvar
 endfunction
 let s:filetype=expand('<sfile>:t:r')
 call s:_f.augroup.add('AuGlog', [['FileType', s:filetype, 0, s:F.setup]])