From 3c83b963d9874b1dc4d2e0ca4b9c48d4f75c133b Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Sat, 4 Apr 2020 22:42:32 -0400 Subject: [PATCH] Stop advancing too far before cutting paper We were advancing the paper too far before cutting, because we weren't accounting for the fact that we probably just moved to a new line. Ensure we do move to a new line, and then factor that into the remaining advance. --- src/render.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/render.rs b/src/render.rs index 4adbaf9..b8b4d31 100644 --- a/src/render.rs +++ b/src/render.rs @@ -263,7 +263,12 @@ impl Renderer { // Advance paper and perform partial cut pub fn cut(&mut self) { - self.spool(b"\x1dV\x42\x68") + // Flush line buffer if non-empty + if self.line_width > 0 { + self.spool_line(); + } + + self.spool(b"\x1dV\x42\x50") } fn spool_line(&mut self) {