# HG changeset patch # User Matthew Wild # Date 1324294737 0 # Node ID 5e8843a869a32387cb0ad254fc4b2728c67d8b04 # Parent c819365ac6abc320e4bf70fd25e813c690b111d1 mod_pastebin: Fix off-by-one in line counting (display issue only) diff -r c819365ac6ab -r 5e8843a869a3 mod_pastebin/mod_pastebin.lua --- a/mod_pastebin/mod_pastebin.lua Mon Dec 19 11:38:06 2011 +0000 +++ b/mod_pastebin/mod_pastebin.lua Mon Dec 19 11:38:57 2011 +0000 @@ -100,7 +100,7 @@ stanza[bodyindex][1] = (summary_prefixed and (summary.." ") or "")..url; if html_preview then - local line_count = select(2, body:gsub("\n", "%0")); + local line_count = select(2, body:gsub("\n", "%0")) + 1; local link_text = ("[view %spaste (%d line%s)]"):format(summary_prefixed and "" or "rest of ", line_count, line_count == 1 and "" or "s"); local html = st.stanza("html", { xmlns = xmlns_xhtmlim }):tag("body", { xmlns = xmlns_xhtml }); html:tag("p"):text(summary.." "):up();