@@ -1705,33 +1705,49 @@ function! s:IgnoreRefs(refs, refsToIgnore) abort
17051705 return index (a: refsToIgnore , a: ref ) == -1
17061706 endfunction
17071707
1708+ " Strip the outer parentheses
17081709 let refs = split (a: refs [1 :-2 ], " , " )
17091710 let refs = filter (refs, function (' ShouldPreserveRef' , [a: refsToIgnore ]))
17101711
17111712 if len (a: refs ) == 0
17121713 return ' '
17131714 endif
17141715
1715- return ' (' . join (refs, " , " ) . ' )'
1716+ return ' (' . join (refs, " , " ) . ' ) '
17161717endfunction
17171718
17181719function ! s: QueryLog (refspec, refToIgnore) abort
17191720 let lines = s: LinesError ([' log' , ' -n' , ' 256' , ' --pretty=format:%h%x09%d%x09%s' , a: refspec , ' --' ])[0 ]
17201721 call map (lines , ' split(v:val, "\t", 1)' )
17211722 let refsToIgnore = [a: refToIgnore , ' HEAD' ]
17221723
1723- function ! HandleRefs (refsToIgnore, refs) abort
1724- return s: IgnoreRefs (trim (a: refs ), a: refsToIgnore )
1724+ function ! HandleRefs (refsToIgnore, subject, refs) abort
1725+ let refs = trim (a: refs )
1726+ let refs = s: IgnoreRefs (refs, a: refsToIgnore )
1727+
1728+ if len (refs) == 0 && a: subject [0 ] == ' ('
1729+ " Add artificial (concealed) empty parentheses for refs. Helps avoid
1730+ " syntax highlighting false-positives (subject lines beginning with an
1731+ " open parenthesis).
1732+ return ' ()'
1733+ endif
1734+
1735+ return refs
1736+ endfunction
1737+
1738+ function ! CreateLineDict (refsToIgnore, index , parts) abort
1739+ let subject = join (a: parts [2 : -1 ], " \t " )
1740+ return {" type" : " Log" , " commit" : a: parts [0 ], " refs" : HandleRefs (a: refsToIgnore , subject, a: parts [1 ]), " subject" : subject}
17251741 endfunction
17261742
1727- call map (lines , ' {"type": "Log", "commit": v:val[0], "refs": ' . string ( function (' HandleRefs ' , [refsToIgnore])) . ' (v:val[1]), "subject": join(v:val[2 : -1], "\t")} ' )
1743+ call map (lines , function (' CreateLineDict ' , [refsToIgnore]))
17281744 return lines
17291745endfunction
17301746
17311747function ! s: FormatLog (dict ) abort
17321748 setlocal conceallevel= 3
17331749 setlocal concealcursor= nc
1734- return a: dict .commit . ' ' . ((len (a: dict .refs) > 0 ) ? ( " \x1f " . a: dict .refs . ' ' ) : ' ' ) . a: dict .subject
1750+ return a: dict .commit . ' ' . ((len (a: dict .refs) > 0 ) ? a: dict .refs : ' ' ) . a: dict .subject
17351751endfunction
17361752
17371753function ! s: FormatRebase (dict ) abort
0 commit comments