File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1228,9 +1228,23 @@ class ReceiptPrinterEncoder {
1228
1228
* @return {array } All the commands currently in the queue
1229
1229
*/
1230
1230
commands ( ) {
1231
+ let requiresFlush = true ;
1232
+
1233
+ /* Determine if the last command is a pulse or cut, the we do not need a flush */
1234
+
1235
+ let lastLine = this . #queue[ this . #queue. length - 1 ] ;
1236
+
1237
+ if ( lastLine ) {
1238
+ let lastCommand = lastLine [ lastLine . length - 1 ] ;
1239
+
1240
+ if ( lastCommand && [ 'pulse' , 'cut' ] . includes ( lastCommand . type ) ) {
1241
+ requiresFlush = false ;
1242
+ }
1243
+ }
1244
+
1231
1245
/* Flush the printer line buffer if needed */
1232
1246
1233
- if ( this . #options. autoFlush && ! this . #options. embedded ) {
1247
+ if ( requiresFlush && this . #options. autoFlush && ! this . #options. embedded ) {
1234
1248
this . #composer. add (
1235
1249
this . #language. flush ( ) ,
1236
1250
) ;
You can’t perform that action at this time.
0 commit comments