Add :clear() method to remove progress bar and pretend it was never there default tip

Wed, 08 Aug 2012 12:17:13 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 08 Aug 2012 12:17:13 +0100
changeset 4
3cd674f5353b
parent 3
d3e20e89d06b

Add :clear() method to remove progress bar and pretend it was never there

progress.lua file | annotate | diff | comparison | revisions
--- a/progress.lua	Fri May 21 12:56:15 2010 +0100
+++ b/progress.lua	Wed Aug 08 12:17:13 2012 +0100
@@ -28,7 +28,11 @@
 		write("\027[3A\n");
 		needs_update = false;
 	end
-	return { refresh = update_progress_display, update = update_data };
+
+	local function clear()
+		write(("\n\027[K"):rep(3), "\027[3A");
+	end
+	return { refresh = update_progress_display, update = update_data, clear = clear };
 end
 
 return _M;

mercurial