Skip to content

Commit

Permalink
Stop advancing too far before cutting paper
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bgilbert committed Apr 5, 2020
1 parent 90a5c8f commit 3c83b96
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ impl<F: Read + Write> Renderer<F> {

// 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) {
Expand Down

0 comments on commit 3c83b96

Please sign in to comment.