From 89d85541ef4d1ebf0f7dc1c6edaaee489928bf23 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Tue, 24 Oct 2017 22:09:22 +0100 Subject: [PATCH] Scroll to bottom of console after inputting command --- CliClient/app/app-gui.js | 4 +++- CliClient/app/command-help.js | 1 + CliClient/app/gui/StatusBarWidget.js | 6 ++++-- CliClient/app/help-utils.js | 2 +- CliClient/locales/en_GB.po | 5 +++++ CliClient/locales/fr_FR.po | 5 +++++ CliClient/locales/joplin.pot | 5 +++++ ReactNativeClient/lib/models/setting.js | 1 - 8 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CliClient/app/app-gui.js b/CliClient/app/app-gui.js index 6170649e3..cd643c67e 100644 --- a/CliClient/app/app-gui.js +++ b/CliClient/app/app-gui.js @@ -259,7 +259,7 @@ class AppGui { } addCommandToConsole(cmd) { - this.stdout(chalk.cyan.bold('> ' + cmd)); + this.stdout(chalk.cyan.bold('> ' + cmd)); } setupShortcuts() { @@ -524,6 +524,8 @@ class AppGui { } catch (error) { this.stdout(error.message); } + + this.widget('console').scrollBottom(); } async updateFolderList() { diff --git a/CliClient/app/command-help.js b/CliClient/app/command-help.js index 0aaf9b1e2..8e6d07f5f 100644 --- a/CliClient/app/command-help.js +++ b/CliClient/app/command-help.js @@ -56,6 +56,7 @@ class Command extends BaseCommand { this.stdout(commandNames.join(', ')); this.stdout(''); this.stdout(_('To move from one widget to another, press Tab or Shift+Tab.')); + this.stdout(_('Use the arrows and page up/down to scroll the lists and text areas (including this console).')); this.stdout(_('To maximise/minimise the console, press "C".')); this.stdout(_('To enter command line mode, press ":"')); this.stdout(_('To exit command line mode, press ESCAPE')); diff --git a/CliClient/app/gui/StatusBarWidget.js b/CliClient/app/gui/StatusBarWidget.js index fbc769419..3b040aefa 100644 --- a/CliClient/app/gui/StatusBarWidget.js +++ b/CliClient/app/gui/StatusBarWidget.js @@ -116,8 +116,10 @@ class StatusBarWidget extends BaseWidget { if (input === undefined) { // User cancel } else { - resolveResult = input; - if (input && input.trim() != '') this.history_.push(input); + resolveResult = input ? input.trim() : input; + // Add the command to history but only if it's longer than one character. + // Below that it's usually an answer like "y"/"n", etc. + if (input && input.length > 1) this.history_.push(input); } } diff --git a/CliClient/app/help-utils.js b/CliClient/app/help-utils.js index 74fd4cb55..3a76afb97 100644 --- a/CliClient/app/help-utils.js +++ b/CliClient/app/help-utils.js @@ -77,7 +77,7 @@ function renderCommandHelp(cmd, width = null) { if (defaultString !== null) desc.push(_('Default: %s', defaultString)); - return [md.key, desc.join('\n')]; + return [md.key, desc.join("\n")]; }; output.push(''); diff --git a/CliClient/locales/en_GB.po b/CliClient/locales/en_GB.po index 6a49e4fd9..d78de30c9 100644 --- a/CliClient/locales/en_GB.po +++ b/CliClient/locales/en_GB.po @@ -253,6 +253,11 @@ msgstr "" msgid "To move from one widget to another, press Tab or Shift+Tab." msgstr "" +msgid "" +"Use the arrows and page up/down to scroll the lists and text area (including " +"the console)." +msgstr "" + msgid "To maximise/minimise the console, press \"C\"." msgstr "" diff --git a/CliClient/locales/fr_FR.po b/CliClient/locales/fr_FR.po index 9fab94b11..262251594 100644 --- a/CliClient/locales/fr_FR.po +++ b/CliClient/locales/fr_FR.po @@ -280,6 +280,11 @@ msgstr "" msgid "To move from one widget to another, press Tab or Shift+Tab." msgstr "" +msgid "" +"Use the arrows and page up/down to scroll the lists and text area (including " +"the console)." +msgstr "" + #, fuzzy msgid "To maximise/minimise the console, press \"C\"." msgstr "Quitter le logiciel." diff --git a/CliClient/locales/joplin.pot b/CliClient/locales/joplin.pot index 6a49e4fd9..d78de30c9 100644 --- a/CliClient/locales/joplin.pot +++ b/CliClient/locales/joplin.pot @@ -253,6 +253,11 @@ msgstr "" msgid "To move from one widget to another, press Tab or Shift+Tab." msgstr "" +msgid "" +"Use the arrows and page up/down to scroll the lists and text area (including " +"the console)." +msgstr "" + msgid "To maximise/minimise the console, press \"C\"." msgstr "" diff --git a/ReactNativeClient/lib/models/setting.js b/ReactNativeClient/lib/models/setting.js index 9a84fdb17..b98013f89 100644 --- a/ReactNativeClient/lib/models/setting.js +++ b/ReactNativeClient/lib/models/setting.js @@ -212,7 +212,6 @@ class Setting extends BaseModel { static enumOptionsDoc(key, templateString = null) { if (templateString === null) templateString = '%s: %s'; - console.info(templateString); const options = this.enumOptions(key); let output = []; for (let n in options) {