Skip to content

Commit 91eef30

Browse files
committed
Fixed scr error in differences that had no matches.
1 parent 9a4b0d2 commit 91eef30

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xtra/DIFF.LUA

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ local function diff_u(fn1,fn2)
1919
local b1,e,b2=line(fn1,o1,l1)if not b1 then error(e)end b2,e=line(fn2,o2,l2)if not b2 then error(e)end
2020
return b1==b2 end
2121
local h,w,m=#f1//ps,#f2//ps,{}for i=1,h do for j=1,w do if cmp(i,j)then table.insert(m,j+(h*(i-1)))end end end
22-
local function scr(x,y)local i,j=y+h*(x-1),1
23-
repeat if m[j]<=i then j=j+1 else break end until (j>#m)return j-1 end
22+
local function scr(x,y)if #m==0 then return 0 end local i,j=y+h*(x-1),1
23+
repeat if m[j]<=i then j=j+1 else break end until j>#m return j-1 end
2424
local x,y,path=h,w,{}while x>0 and y>0 do
2525
local s=scr(x,y)if scr(x,y-1)==s-1 then table.insert(path,1,{x=x,y=y})x,y=x-1,y-1
2626
elseif scr(x-1,y)==s then x=x-1 else y=y-1 end end

0 commit comments

Comments
 (0)