Skip to content

Commit 20bd345

Browse files
committed
Print line number of 1 instead of 0 if buf.ls or buf.rs is not set.
1 parent a2688a0 commit 20bd345

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

demo/xtra/DIFF.LUA

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env lua
1+
#!/usr/bin/env lua
22

33
local function diff_u(fn1,fn2)
44
local function open(fn) local f, e = io.open(fn) if not f then print(e) os.exit(1) end return f end
@@ -17,8 +17,8 @@ local function diff_u(fn1,fn2)
1717
local function flush_buf()
1818
if #buf.line > 0 then
1919
buf.del, buf.add = #buf.line - buf.add - p1, #buf.line - buf.del - p2
20-
local header = "@@ -" .. (buf.ls or "0") .. (buf.del == 1 and "" or "," .. buf.del) ..
21-
" +" .. (buf.rs or "0") .. (buf.add == 1 and "" or "," .. buf.add) .. " @@"
20+
local header = "@@ -" .. (buf.ls or "1") .. (buf.del == 1 and "" or "," .. buf.del) ..
21+
" +" .. (buf.rs or "1") .. (buf.add == 1 and "" or "," .. buf.add) .. " @@"
2222
table.insert(buf.line, 1, header)
2323
for _, v in ipairs(buf.line) do print(v) end
2424
end

0 commit comments

Comments
 (0)