From 51fecb182b77a4c4ccf34236ea52cb675f1b2d20 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sun, 27 Jan 2019 14:17:22 +0100 Subject: [PATCH] Update show offset command --- src/commands/index.js | 10 ++++++---- src/commands/view/ShowOffset.js | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/commands/index.js b/src/commands/index.js index a430eb403..ae43fc611 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -349,11 +349,10 @@ module.exports = () => { const editor = em.get('Editor'); if (!this.isActive(id)) { - result = command.callRun(editor, options); - if (id && command.stop && !command.noStop) { active[id] = result; } + result = command.callRun(editor, options); } } @@ -373,8 +372,11 @@ module.exports = () => { if (command && command.run) { const id = command.id; const editor = em.get('Editor'); - result = command.callStop(editor, options); - if (id) delete active[id]; + + if (this.isActive(id)) { + if (id) delete active[id]; + result = command.callStop(editor, options); + } } return result; diff --git a/src/commands/view/ShowOffset.js b/src/commands/view/ShowOffset.js index 7af11174f..e8bf7d580 100644 --- a/src/commands/view/ShowOffset.js +++ b/src/commands/view/ShowOffset.js @@ -17,6 +17,7 @@ module.exports = { !config.showOffsets || (!config.showOffsetsSelected && state == 'Fixed') ) { + editor.stopCommand(this.id, opts); return; }