changeset 513:5e8843a869a3

mod_pastebin: Fix off-by-one in line counting (display issue only)
author Matthew Wild <mwild1@gmail.com>
date Mon, 19 Dec 2011 11:38:57 +0000
parents c819365ac6ab
children 46e1983486e9
files mod_pastebin/mod_pastebin.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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();