-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
doc: readline.emitKeypressEvents note #9447
Conversation
doc/api/readline.md
Outdated
@@ -447,6 +447,10 @@ autocompletion is disabled when copy-pasted input is detected. | |||
|
|||
If the `stream` is a [TTY][], then it must be in raw mode. | |||
|
|||
*Note* This is automatically called by any readline instance on its `input`, |
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.
A few small nitpicks:
Nit: Put a :
after *Note*
to match the other five instances in the doc: *Note*: This is automatically...
Nit: Remove the comma after input
.
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.
Was modeling that after the Note
on L30 - I'll fix that too.
doc/api/readline.md
Outdated
@@ -447,6 +447,10 @@ autocompletion is disabled when copy-pasted input is detected. | |||
|
|||
If the `stream` is a [TTY][], then it must be in raw mode. | |||
|
|||
*Note* This is automatically called by any readline instance on its `input`, | |||
if the `input` is a terminal. Cleaning up the readline does not stop the |
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.
Is there wording that might be more precise than "cleaning up"?
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.
Yep - will fix
545597a
to
e42c50a
Compare
Amended |
doc/api/readline.md
Outdated
@@ -447,6 +447,10 @@ autocompletion is disabled when copy-pasted input is detected. | |||
|
|||
If the `stream` is a [TTY][], then it must be in raw mode. | |||
|
|||
*Note*: This is automatically called by any readline instance on its `input` | |||
if the `input` is a terminal. Closing the readline does not stop the `input` |
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.
Maybe this?:
Closing the
readline
instance does not...
...instead of:
Closing the readline does not...
Formatting etc. all LGTM. One tiny style nit. Maybe someone else can review that the content is correct, applies across all platforms, etc. (Judging from the git logs, perhaps one of @piscisaureus @rlidwka @isaacs @princejwesley?) |
e42c50a
to
05f39ed
Compare
Thanks for the review. Updated again. |
@@ -447,6 +447,10 @@ autocompletion is disabled when copy-pasted input is detected. | |||
|
|||
If the `stream` is a [TTY][], then it must be in raw mode. | |||
|
|||
*Note*: This is automatically called by any readline instance on its `input` |
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.
Note after code snippet ?
@@ -447,6 +447,10 @@ autocompletion is disabled when copy-pasted input is detected. | |||
|
|||
If the `stream` is a [TTY][], then it must be in raw mode. | |||
|
|||
*Note*: This is automatically called by any readline instance on its `input` | |||
if the `input` is a terminal. Closing the `readline` instance does not stop |
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.
@Trott Sounds like a bug to me.
function onNewListener(event) {
if (event == 'keypress') {
stream.on('data', onData);
// +++++++++ MISSING +++++++++++
iface.once('close', () => {
stream.removeListener('data', onData);
});
// +++++++++++++++++++++++++++++
stream.removeListener('newListener', onNewListener);
}
}
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.
Ping @Trott @princejwesley ... any further thoughts on this?
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.
Not sure why I I'm being pinged on this (as opposed to anybody else) to be honest...
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.
(Also not sure who a good person to ping about it would be, though. ¯\(ツ)/¯ )
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.
(Also not sure who a good person to ping about it would be, though. ¯\(ツ)/¯ )
I think with hindsight we can say @addaleax would be a good person to ping 😉
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.
Well … what I remember about these parts of the code mostly comes from reviewing ae17883, and that was a year ago. I guess at this point we don’t have any real readline experts…
@nodejs/ctc ... anyone have thoughts on this? |
There hasn't been any activity here. I'm closing this. Feel free to reopen (or ping a collaborator) if I closed this in error. |
Please reopen. This bug is still valid, it's just that nobody reviewed it.
…On May 26, 2017 3:19 PM, "F. Hinkelmann" ***@***.***> wrote:
Closed #9447 <#9447>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9447 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ABJFP1rDWVPuXAqJzA0gwd7GYBmHSDK8ks5r9yWogaJpZM4Komxd>
.
|
Once the Readline interface is closed, the 'data' event listener should be removed. Refs: nodejs#9447 (comment)
This seems to be correct looking at the code, so that part LGTM
I'd rather fix this than document it (assuming it's a bug), see #13266 |
Once the Readline interface is closed, the 'data' event listener should be removed. PR-URL: #13266 Ref: #9447 (comment) Reviewed-By: James M Snell <jasnell@gmail.com>
Once the Readline interface is closed, the 'data' event listener should be removed. PR-URL: #13266 Ref: #9447 (comment) Reviewed-By: James M Snell <jasnell@gmail.com>
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.
This is not a bug, see #13560 (for a bit of explanation and a test that shows why we can’t remove the decoder once it’s there).
Thanks for catching this and sorry that this has been open so long! I’ll wait a bit to see if there’s any movement in the other issues (edit: before landing, I mean).
Landed in ac34779, thank you for the PR! |
PR-URL: #9447 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
PR-URL: #9447 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
is this applicable to v6.x? |
PR-URL: #9447 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Affected core subsystem(s)
doc
Description of change
It is not noted in the docs that
emitKeypressEvents
is automatically called on anyinput
stream whereinput.terminal
orinput.isTTY
istrue
.This can cause incompatibility with libraries that fire their own
keypress
events, like blessed.I am working to fix the incompatibility but I thought it was worth noting in the docs.