1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

CLI: Fixes #117: 'edit' command raising error in shell mode

This commit is contained in:
Laurent Cozic
2017-12-28 19:14:03 +00:00
parent 0926755635
commit ab959623aa
4 changed files with 19 additions and 5 deletions

View File

@@ -80,6 +80,14 @@ class AppGui {
await this.renderer_.renderRoot();
}
termSaveState() {
return this.term().saveState();
}
termRestoreState(state) {
return this.term().restoreState(state);
}
prompt(initialText = '', promptString = ':') {
return this.widget('statusBar').prompt(initialText, promptString);
}

View File

@@ -283,7 +283,10 @@ class Application extends BaseApplication {
exit: () => {},
showModalOverlay: (text) => {},
hideModalOverlay: () => {},
stdoutMaxWidth: () => { return 78; }
stdoutMaxWidth: () => { return 78; },
forceRender: () => {},
termSaveState: () => {},
termRestoreState: (state) => {},
};
}

View File

@@ -76,12 +76,12 @@ class Command extends BaseCommand {
app().gui().showModalOverlay(_('Starting to edit note. Close the editor to get back to the prompt.'));
await app().gui().forceRender();
const termState = app().gui().term().saveState();
const termState = app().gui().termSaveState();
const spawnSync = require('child_process').spawnSync;
spawnSync(editorPath, editorArgs, { stdio: 'inherit' });
app().gui().term().restoreState(termState);
app().gui().termRestoreState(termState);
app().gui().hideModalOverlay();
app().gui().forceRender();