Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-12-27 17:32:39 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2020-01-10 11:11:47 +0300
commit625a0ec5e18f85ee7b1589f308d2c93116484007 (patch)
tree353b4a59c9d7dab4aa60f49975cab6e566ebb92f /lib/internal/readline
parent07c55bb81fcf05a070168e570b618461ad4a847e (diff)
readline,repl: add substring based history search
This improves the current history search feature by adding substring based history search similar to ZSH. In case the `UP` or `DOWN` buttons are pressed after writing a few characters, the start string up to the current cursor is used to search the history. All other history features work exactly as they used to. PR-URL: https://github.com/nodejs/node/pull/31112 Fixes: https://github.com/nodejs/node/issues/28437 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/readline')
-rw-r--r--lib/internal/readline/utils.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/internal/readline/utils.js b/lib/internal/readline/utils.js
index 3ff50124e74..6a2d1553655 100644
--- a/lib/internal/readline/utils.js
+++ b/lib/internal/readline/utils.js
@@ -4,6 +4,7 @@ const {
Boolean,
NumberIsInteger,
RegExp,
+ Symbol,
} = primordials;
// Regex used for ansi escape code splitting
@@ -17,6 +18,7 @@ const ansi = new RegExp(ansiPattern, 'g');
const kUTF16SurrogateThreshold = 0x10000; // 2 ** 16
const kEscape = '\x1b';
+const kSubstringSearch = Symbol('kSubstringSearch');
let getStringWidth;
let isFullWidthCodePoint;
@@ -470,6 +472,7 @@ module.exports = {
emitKeys,
getStringWidth,
isFullWidthCodePoint,
+ kSubstringSearch,
kUTF16SurrogateThreshold,
stripVTControlCharacters,
CSI