Skip to content

Commit 6bd2db8

Browse files
committed
Only flush only happens after enough trailing context lines have been written.
1 parent ae149a6 commit 6bd2db8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

xtra/DIFF.LUA

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,14 @@ local function diff_u(fn1,fn2)
5050
j,u.n.l,u.e=j+1,u.n.l+1,0
5151
end
5252
if u then
53-
while u.e<4 and i<=h and j<=w do
53+
local c=p.l>5 and 4 or p.l
54+
while u.e<c and i<=h and j<=w do
5455
table.insert(u.l,pfl(" ",get(fn1,f1,i)))
5556
i,j,u.e,u.o.l,u.n.l=i+1,j+1,u.e+1,u.o.l+1,u.n.l+1
5657
end
57-
flush()
58+
if p.l>5 then
59+
flush()
60+
end
5861
end
5962
i,j=p.x+p.l,p.y+p.l
6063
end

0 commit comments

Comments
 (0)