Skip to content
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

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

Closed

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Jan 9, 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.

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

@BridgeAR BridgeAR added the blocked PRs that are blocked by other issues or PRs. label Jan 9, 2020
@nodejs-github-bot nodejs-github-bot added the readline Issues and PRs related to the built-in readline module. label Jan 9, 2020
@BridgeAR BridgeAR 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
@BridgeAR BridgeAR 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 BridgeAR force-pushed the 2020-01-09-readline-improvements branch from 2e65b26 to a019c62 Compare January 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 BridgeAR force-pushed the 2020-01-09-readline-improvements branch from 9211679 to 23c754f Compare January 10, 2020 17:46
@BridgeAR BridgeAR changed the title readline: improve unicode support and tab completion repl,readline: improve unicode support and tab completion Jan 10, 2020
@BridgeAR BridgeAR requested a review from jasnell January 10, 2020 17:48
@BridgeAR
Copy link
Member Author

@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
Collaborator

getStringWidth(this.line[this.cursor]) > 1) {
rows++;
cols = 0;
}
Copy link
Member Author

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.

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@Trott Trott left a comment

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
Member

Trott commented Jan 11, 2020

@BridgeAR BridgeAR 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
Collaborator

@Trott
Copy link
Member

Trott commented Jan 11, 2020

Landed in a523283...fe05818

@Trott Trott 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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@codebytere codebytere mentioned this pull request Jan 16, 2020
@codebytere
Copy link
Member

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

@targos targos 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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
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 <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants