GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — readline,repl: add substring history search by BridgeAR · Pull Request #31112 · nodejs/node

Conversation

@BridgeAR

@BridgeAR BridgeAR commented Dec 27, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Please see the individual commit messages for details.

Fixes: #28437
Fixes: #25272

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot 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
BridgeAR force-pushed the 2019-12-27-repl-substring-history-search branch 2 times, most recently from 5b21b6c to a36f1a8 Compare January 4, 2020 08:44
@BridgeAR
BridgeAR marked this pull request as ready for review January 4, 2020 11:14
@BridgeAR

BridgeAR commented Jan 4, 2020

Copy link
Copy Markdown
Member Author

@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

  • adds substring history search,
  • improves unicode support,
  • adds support for tabs,
  • improves previews of very long input,
  • refactors code for simplicity and
  • improves the performance of the GetColumnWidth function for some inputs.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR
BridgeAR requested review from Trott, benjamingr, jasnell, srl295 and targos January 4, 2020 11:18
@nodejs-github-bot

This comment has been minimized.

Sign in to view
addaleax
addaleax reviewed Jan 5, 2020
View reviewed changes
Comment thread doc/api/repl.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread doc/api/repl.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/internal/repl/utils.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/node_i18n.cc Resolved

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

This comment has been minimized.

Sign in to view
jasnell
jasnell reviewed Jan 7, 2020
View reviewed changes
Comment thread test/parallel/test-repl-reverse-search.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR
BridgeAR force-pushed the 2019-12-27-repl-substring-history-search branch from 97ecd26 to 6c73393 Compare January 8, 2020 09:57
BridgeAR added 4 commits January 8, 2020 11:58
@BridgeAR
repl: improve preview length calculation
05c19bd
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.
@BridgeAR
readline,repl: add substring based history search
470e87f
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
@BridgeAR
readline,repl: skip history entries identical to the current line
6efc2b9
Skip history entries that are identical to the currently visible line
to improve the user experience.
@BridgeAR
readline,repl: improve history up/previous
5a213fe
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
BridgeAR force-pushed the 2019-12-27-repl-substring-history-search branch from 6c73393 to 9e958f3 Compare January 8, 2020 11:00
@nodejs-github-bot

This comment has been minimized.

Sign in to view
BridgeAR added 8 commits January 8, 2020 12:05
@BridgeAR
readline: simplify getStringWidth()
3b8315c
Simplify getStringWidth by removing dead code (the options were
unused) and by refactoring the logic.
@BridgeAR
readline: move charLengthLeft() and charLengthAt()
d6b1bac
This moves the charLengthLeft() and charLengthAt() into the internal
readline file. This allows sharing the functions internally with
other code.
@BridgeAR
src: improve GetColumnWidth performance
9f7730e
This improves the performance in GetColumnWidth for full width
characters.
@BridgeAR
src: change GetStringWidth's expand_emoji_sequence option default
e9bc956
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.
@BridgeAR
readline,repl: support tabs properly
6dd223b
Fixes: nodejs#25272
@BridgeAR
repl: activate previews for lines exceeding the terminal columns
26d4643
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.
@BridgeAR
test: add repl tests to verify unicode support in previews
387a327
This also adds a test to verify that changed writer options also
change the preview output depending on the options.
@BridgeAR
util: add todo comments for inspect to add unicode support
9f5aa54
@codebytere

codebytere commented Mar 14, 2020

Copy link
Copy Markdown
Member

@BridgeAR should this go back to v12.x? It doesn't land cleanly; i'll add a backport-requested label but feel free to swap it out!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codebytere codebytere added the backport-requested-v12.x label Mar 14, 2020
@codebytere codebytere mentioned this pull request Mar 14, 2020
repl: change preview default in case of custom eval functions #31259
Closed
4 tasks done
@targos targos added semver-minor PRs that contain new features and should be released in the next minor version. and removed author ready PRs with CI started, the required approvals, and no outstanding review comments. backport-requested-v12.x labels Apr 25, 2020
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
repl: improve preview length calculation
f66bcda
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
readline,repl: add substring based history search
bf62a83
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
readline,repl: skip history entries identical to the current line
cb0a321
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
readline,repl: improve history up/previous
fde18ac
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
readline: improve getStringWidth()
7163b1e
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
readline: move charLengthLeft() and charLengthAt()
1818611
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
src: improve GetColumnWidth performance
e4b5719
This improves the performance in GetColumnWidth for full width
characters.

PR-URL: nodejs#31112
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
src: change GetStringWidth's expand_emoji_sequence option default
689bcd1
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@BridgeAR @targos
readline,repl: support tabs properly
50a16ed
PR-URL: nodejs#31112
Fixes: nodejs#25272
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@targos targos mentioned this pull request May 2, 2020
v12.17.0 release proposal #33197
Merged
@todo todo Bot mentioned this pull request May 26, 2020
[pull] master from nodejs:master daddyfatstacksBIG/node#715
Merged
@marcopiraccini marcopiraccini mentioned this pull request Oct 11, 2026
util: add getStringWidth() #66642
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@Trott Trott Awaiting requested review from Trott
@benjamingr benjamingr Awaiting requested review from benjamingr
@srl295 srl295 Awaiting requested review from srl295
@addaleax addaleax Awaiting requested review from addaleax
+1 more reviewer
@targos targos targos approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

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.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

repl: substring based search history Tabs in the repl cause display issues

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@BridgeAR @nodejs-github-bot @targos @codebytere @jasnell @addaleax
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.