Skip to content

repl,readline: improve unicode support and tab completion - #31288

Closed
BridgeAR wants to merge 2 commits into
nodejs:masterfrom
BridgeAR:2020-01-09-readline-improvements
Closed

repl,readline: improve unicode support and tab completion#31288
BridgeAR wants to merge 2 commits into
nodejs:masterfrom
BridgeAR:2020-01-09-readline-improvements

Conversation

@BridgeAR

@BridgeARBridgeAR commented Jan 9, 2020

Copy link
Copy Markdown
Member
  1. This reduces the number of write operations used during tab
    completion.
  2. The tab completion calculated the string width using the length
    of the string instead of using the actual width. That is fixed.
  3. The key decoder is now capable of handling characters composed
    out of two code points. That reduces the number of "keypress"
    events that are emitted which again lowers the amount of writes
    triggered.

This is currently blocked by #31112 (moving the charLengthAt function).

// cc @nodejs/repl @nodejs/readline

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

@BridgeARBridgeAR added the blocked PRs that are blocked by other issues or PRs. label Jan 9, 2020
@nodejs-github-botnodejs-github-bot added the readline Issues and PRs related to the built-in readline module. label Jan 9, 2020
@BridgeARBridgeAR added performance Issues and PRs related to the performance of Node.js. repl Issues and PRs related to the REPL subsystem. and removed performance Issues and PRs related to the performance of Node.js. labels Jan 9, 2020
@BridgeARBridgeAR removed the blocked PRs that are blocked by other issues or PRs. label Jan 10, 2020
1. This reduces the number of write operations used during tab
completion.
2. The tab completion calculated the string width using the length
of the string instead of using the actual width. That is fixed.
3. The key decoder is now capable of handling characters composed
out of two code points. That reduces the number of "keypress"
events that are emitted which again lowers the amount of writes
triggered.
@BridgeAR
BridgeARforce-pushed the 2020-01-09-readline-improvements branch from 2e65b26 to a019c62CompareJanuary 10, 2020 08:18
This simplifies code that was more complicated than it had to be
and removes code that should never be reached.
@BridgeAR
BridgeARforce-pushed the 2020-01-09-readline-improvements branch from 9211679 to 23c754fCompareJanuary 10, 2020 17:46
@BridgeARBridgeAR changed the title readline: improve unicode support and tab completionrepl,readline: improve unicode support and tab completionJan 10, 2020
@BridgeAR
BridgeAR requested a review from jasnellJanuary 10, 2020 17:48
@BridgeAR

Copy link
Copy Markdown
MemberAuthor

@jasnell I pushed another commit that cleans up some code. It would have conflicted with the former commit if I would have opened another PR for it instead. PTAL.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/readline.js
getStringWidth(this.line[this.cursor]) > 1) {
rows++;
cols = 0;
}

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our cursor can't be between two code points. We move the cursor by the correct length since a while.

@BridgeARBridgeAR mentioned this pull request Jan 11, 2020
4 tasks
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@TrottTrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I'm going to kick off a CITGM just to make sure the readline changes aren't breaking in an unexpected way.

@Trott

Copy link
Copy Markdown
Member

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 11, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Trott

Copy link
Copy Markdown
Member

Landed in a523283...fe05818

@TrottTrott closed this Jan 11, 2020
Trott pushed a commit that referenced this pull request Jan 11, 2020
1. This reduces the number of write operations used during tab
completion.
2. The tab completion calculated the string width using the length
of the string instead of using the actual width. That is fixed.
3. The key decoder is now capable of handling characters composed
out of two code points. That reduces the number of "keypress"
events that are emitted which again lowers the amount of writes
triggered.
PR-URL: #31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Trott pushed a commit that referenced this pull request Jan 11, 2020
This simplifies code that was more complicated than it had to be
and removes code that should never be reached.
PR-URL: #31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 16, 2020
1. This reduces the number of write operations used during tab
completion.
2. The tab completion calculated the string width using the length
of the string instead of using the actual width. That is fixed.
3. The key decoder is now capable of handling characters composed
out of two code points. That reduces the number of "keypress"
events that are emitted which again lowers the amount of writes
triggered.
PR-URL: #31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jan 16, 2020
This simplifies code that was more complicated than it had to be
and removes code that should never be reached.
PR-URL: #31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@codebyterecodebytere mentioned this pull request Jan 16, 2020
@codebytere

Copy link
Copy Markdown
Member

@BridgeAR should this go back to v12.x? I'll add the label but feel free to swap out.

@targostargos 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
1. This reduces the number of write operations used during tab
completion.
2. The tab completion calculated the string width using the length
of the string instead of using the actual width. That is fixed.
3. The key decoder is now capable of handling characters composed
out of two code points. That reduces the number of "keypress"
events that are emitted which again lowers the amount of writes
triggered.
PR-URL: nodejs#31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
This simplifies code that was more complicated than it had to be
and removes code that should never be reached.
PR-URL: nodejs#31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this pull request Apr 28, 2020
1. This reduces the number of write operations used during tab
completion.
2. The tab completion calculated the string width using the length
of the string instead of using the actual width. That is fixed.
3. The key decoder is now capable of handling characters composed
out of two code points. That reduces the number of "keypress"
events that are emitted which again lowers the amount of writes
triggered.
PR-URL: #31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this pull request Apr 28, 2020
This simplifies code that was more complicated than it had to be
and removes code that should never be reached.
PR-URL: #31288
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@targostargos mentioned this pull request May 2, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readlineIssues and PRs related to the built-in readline module.replIssues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@BridgeAR@nodejs-github-bot@Trott@codebytere@jasnell@targos