-
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
repl,readline: improve unicode support and tab completion #31288
Conversation
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.
2e65b26
to
a019c62
Compare
This simplifies code that was more complicated than it had to be and removes code that should never be reached.
9211679
to
23c754f
Compare
@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. |
getStringWidth(this.line[this.cursor]) > 1) { | ||
rows++; | ||
cols = 0; | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
Landed in a523283...fe05818 |
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]>
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]>
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]>
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]>
@BridgeAR should this go back to |
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]>
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]>
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]>
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]>
completion.
of the string instead of using the actual width. That is fixed.
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 thecharLengthAt
function).// cc @nodejs/repl @nodejs/readline
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes