From ea055ab58bf35994d20feeba098979d3659ad204 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Thu, 3 Jan 2019 21:02:42 -0700 Subject: [PATCH] Handle pause for text-only interruptions also --- core/user_interrupt_queue.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/core/user_interrupt_queue.js b/core/user_interrupt_queue.js index 2e72bbd1..29a52685 100644 --- a/core/user_interrupt_queue.js +++ b/core/user_interrupt_queue.js @@ -81,18 +81,28 @@ module.exports = class UserInterruptQueue this.client.term.rawWrite('\r\n\r\n'); } + const maybePauseAndFinish = () => { + if(interruptItem.pause) { + this.client.currentMenuModule.pausePrompt( () => { + return cb(null); + }); + } else { + return cb(null); + } + }; + if(interruptItem.contents) { Art.display(this.client, interruptItem.contents, err => { if(err) { return cb(err); } //this.client.term.rawWrite('\r\n\r\n'); // :TODO: Prob optional based on contents vs text - this.client.currentMenuModule.pausePrompt( () => { - return cb(null); - }); + maybePauseAndFinish(); }); } else { - return this.client.term.write(pipeToAnsi(`${interruptItem.text}\r\n\r\n`, this.client), cb); + this.client.term.write(pipeToAnsi(`${interruptItem.text}\r\n\r\n`, this.client), true, () => { + maybePauseAndFinish(); + }); } } }; \ No newline at end of file