-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
readline,repl: add substring history search #31112
Closed
BridgeAR
wants to merge
14
commits into
nodejs:master
from
BridgeAR:2019-12-27-repl-substring-history-search
Closed
readline,repl: add substring history search #31112
BridgeAR
wants to merge
14
commits into
nodejs:master
from
BridgeAR:2019-12-27-repl-substring-history-search
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nodejs-github-bot
added
readline
Issues and PRs related to the built-in readline module.
repl
Issues and PRs related to the REPL subsystem.
labels
Dec 27, 2019
BridgeAR
force-pushed
the
2019-12-27-repl-substring-history-search
branch
2 times, most recently
from
January 4, 2020 08:44
5b21b6c
to
a36f1a8
Compare
@nodejs/repl @nodejs/readline PTAL. I included a couple of smaller things that are all somewhat connected. I can split this into multiple PRs if requested. This
|
This comment has been minimized.
This comment has been minimized.
addaleax
reviewed
Jan 5, 2020
This comment has been minimized.
This comment has been minimized.
jasnell
reviewed
Jan 7, 2020
BridgeAR
force-pushed
the
2019-12-27-repl-substring-history-search
branch
from
January 8, 2020 09:57
97ecd26
to
6c73393
Compare
The preview had an off by one error in case colors where deactivated and did not take fullwidth unicode characters into account when displaying the preview.
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. Fixes: nodejs#28437
Skip history entries that are identical to the currently visible line to improve the user experience.
Reaching the history end caused the last entry to be persistent. That way there's no actualy feedback to the user that the history end is reached. Instead, visualize the original input line and keep the history index at the history end in case the user wants to go back again.
BridgeAR
force-pushed
the
2019-12-27-repl-substring-history-search
branch
from
January 8, 2020 11:00
6c73393
to
9e958f3
Compare
This comment has been minimized.
This comment has been minimized.
Simplify getStringWidth by removing dead code (the options were unused) and by refactoring the logic.
This moves the charLengthLeft() and charLengthAt() into the internal readline file. This allows sharing the functions internally with other code.
This improves the performance in GetColumnWidth for full width characters.
The option is now set to true by default. Most terminals do not have full emoji support and visualize emojis with zero width joiners as individual emojis. Also verify that at least one argument is always passed through to the function and remove support for passing through code points. Only accept strings from now on to simplify the API.
This improves the completion previews by activating them for lines that exceed the current terminal columns. As a drive-by fix it also simplifies some statements.
This also adds a test to verify that changed writer options also change the preview output depending on the options.
targos
added
semver-minor
PRs that contain new features and should be released in the next minor version.
and removed
author ready
PRs that have at least one approval, no pending requests for changes, and a CI started.
backport-requested-v12.x
labels
Apr 25, 2020
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
The preview had an off by one error in case colors where deactivated and did not take fullwidth unicode characters into account when displaying the preview. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
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: nodejs#31112 Fixes: nodejs#28437 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
Skip history entries that are identical to the currently visible line to improve the user experience. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
Reaching the history end caused the last entry to be persistent. That way there's no actualy feedback to the user that the history end is reached. Instead, visualize the original input line and keep the history index at the history end in case the user wants to go back again. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
1. Simplify the getStringWidth function used by Intl builds by removing dead code (the options were unused) and by refactoring the logic. 2. Improve the getStringWidth unicode handling used by non-Intl builds. The getStringWidth function returned the wrong width for multiple inputs. It's now improved by supporting various zero width characters and more full width characters. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
This moves the charLengthLeft() and charLengthAt() into the internal readline file. This allows sharing the functions internally with other code. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
This improves the performance in GetColumnWidth for full width characters. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
The option is now set to true by default. Most terminals do not have full emoji support and visualize emojis with zero width joiners as individual emojis. Also verify that at least one argument is always passed through to the function and remove support for passing through code points. Only accept strings from now on to simplify the API. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
PR-URL: nodejs#31112 Fixes: nodejs#25272 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
This improves the completion previews by activating them for lines that exceed the current terminal columns. As a drive-by fix it also simplifies some statements. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
This also adds a test to verify that changed writer options also change the preview output depending on the options. PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
to targos/node
that referenced
this pull request
Apr 25, 2020
PR-URL: nodejs#31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
The preview had an off by one error in case colors where deactivated and did not take fullwidth unicode characters into account when displaying the preview. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
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: #31112 Fixes: #28437 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
Skip history entries that are identical to the currently visible line to improve the user experience. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
Reaching the history end caused the last entry to be persistent. That way there's no actualy feedback to the user that the history end is reached. Instead, visualize the original input line and keep the history index at the history end in case the user wants to go back again. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
1. Simplify the getStringWidth function used by Intl builds by removing dead code (the options were unused) and by refactoring the logic. 2. Improve the getStringWidth unicode handling used by non-Intl builds. The getStringWidth function returned the wrong width for multiple inputs. It's now improved by supporting various zero width characters and more full width characters. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
This moves the charLengthLeft() and charLengthAt() into the internal readline file. This allows sharing the functions internally with other code. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
This improves the performance in GetColumnWidth for full width characters. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
The option is now set to true by default. Most terminals do not have full emoji support and visualize emojis with zero width joiners as individual emojis. Also verify that at least one argument is always passed through to the function and remove support for passing through code points. Only accept strings from now on to simplify the API. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
This improves the completion previews by activating them for lines that exceed the current terminal columns. As a drive-by fix it also simplifies some statements. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
This also adds a test to verify that changed writer options also change the preview output depending on the options. PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Apr 28, 2020
PR-URL: #31112 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
readline
Issues and PRs related to the built-in readline module.
repl
Issues and PRs related to the REPL subsystem.
semver-minor
PRs that contain new features and should be released in the next minor version.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please see the individual commit messages for details.
Fixes: #28437
Fixes: #25272
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes