diff options
author | Devine Lu Linvega <[email protected]> | 2019-04-17 17:46:06 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-04-17 17:46:06 +0900 |
commit | 7c5121ef86ffad17afdb741f9c0ac621ef08b84d (patch) | |
tree | bacff933459d8da9389fe6a3e6e07a7c487b8f3a | |
parent | b1ede29786e3950d6ead2453eb9f66a43d8d5d37 (diff) | |
download | Orca-7c5121ef86ffad17afdb741f9c0ac621ef08b84d.tar.gz Orca-7c5121ef86ffad17afdb741f9c0ac621ef08b84d.zip |
Minor optimisation
-rw-r--r-- | desktop/sources/scripts/commander.js | 5 | ||||
-rw-r--r-- | desktop/sources/scripts/patterns.js | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js index 37d38c2..b64dce4 100644 --- a/desktop/sources/scripts/commander.js +++ b/desktop/sources/scripts/commander.js @@ -84,8 +84,9 @@ function Commander (terminal) { } this.preview = function () { - if (!this.patterns.find(this.query)) { terminal.cursor.reset(); return } - const result = this.patterns.find(this.query).trim().split('\n') + const pattern = this.patterns.find(this.query) + if (!pattern) { terminal.cursor.reset(); return } + const result = pattern.trim().split('\n') terminal.cursor.resize(result[0].length, result.length) } diff --git a/desktop/sources/scripts/patterns.js b/desktop/sources/scripts/patterns.js index fe2a1a5..819f4bd 100644 --- a/desktop/sources/scripts/patterns.js +++ b/desktop/sources/scripts/patterns.js @@ -21,7 +21,7 @@ const Patterns = function (terminal) { this.collection['dy'] = `D8\n.Y` this.find = function (name) { - // Basics + // Statics if (this.collection[name]) { return this.collection[name] } |