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

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
9 participants
@STRML
Contributor

STRML commented Nov 3, 2016

Affected core subsystem(s)

doc

Description of change

It is not noted in the docs that emitKeypressEvents is automatically called on any input stream where input.terminal or input.isTTY is true.

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.

Show outdated Hide outdated doc/api/readline.md
Show outdated Hide outdated doc/api/readline.md
@STRML

This comment has been minimized.

Show comment
Hide comment
@STRML

STRML Nov 3, 2016

Contributor

Amended

Contributor

STRML commented Nov 3, 2016

Amended

Show outdated Hide outdated doc/api/readline.md
@Trott

This comment has been minimized.

Show comment
Hide comment
@Trott

Trott Nov 3, 2016

Member

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?)

Member

Trott commented Nov 3, 2016

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?)

@STRML

This comment has been minimized.

Show comment
Hide comment
@STRML

STRML Nov 3, 2016

Contributor

Thanks for the review. Updated again.

Contributor

STRML commented Nov 3, 2016

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`

This comment has been minimized.

@princejwesley

princejwesley Nov 4, 2016

Contributor

Note after code snippet ?

@princejwesley

princejwesley Nov 4, 2016

Contributor

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

This comment has been minimized.

@princejwesley

princejwesley Nov 4, 2016

Contributor

@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);
    }
  }
@princejwesley

princejwesley Nov 4, 2016

Contributor

@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);
    }
  }

This comment has been minimized.

@jasnell

jasnell Jan 11, 2017

Member

Ping @Trott @princejwesley ... any further thoughts on this?

@jasnell

jasnell Jan 11, 2017

Member

Ping @Trott @princejwesley ... any further thoughts on this?

This comment has been minimized.

@Trott

Trott Jan 11, 2017

Member

Not sure why I I'm being pinged on this (as opposed to anybody else) to be honest...

@Trott

Trott Jan 11, 2017

Member

Not sure why I I'm being pinged on this (as opposed to anybody else) to be honest...

This comment has been minimized.

@Trott

Trott Jan 11, 2017

Member

(Also not sure who a good person to ping about it would be, though. ¯\(ツ)/¯ )

@Trott

Trott Jan 11, 2017

Member

(Also not sure who a good person to ping about it would be, though. ¯\(ツ)/¯ )

This comment has been minimized.

@gibfahn

gibfahn Jun 8, 2017

Member

(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 😉

@gibfahn

gibfahn Jun 8, 2017

Member

(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 😉

This comment has been minimized.

@addaleax

addaleax Jun 8, 2017

Member

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…

@addaleax

addaleax Jun 8, 2017

Member

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…

@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Mar 24, 2017

Member

@nodejs/ctc ... anyone have thoughts on this?

Member

jasnell commented Mar 24, 2017

@nodejs/ctc ... anyone have thoughts on this?

@jasnell jasnell added the stalled label Mar 24, 2017

@fhinkel

This comment has been minimized.

Show comment
Hide comment
@fhinkel

fhinkel May 26, 2017

Member

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.

Member

fhinkel commented May 26, 2017

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.

@fhinkel fhinkel closed this May 26, 2017

@STRML

This comment has been minimized.

Show comment
Hide comment
@STRML

STRML May 27, 2017

Contributor
Contributor

STRML commented May 27, 2017

@fhinkel fhinkel reopened this May 27, 2017

@gibfahn gibfahn referenced this pull request May 28, 2017

Closed

readline: clean up event listener in onNewListener #13266

3 of 3 tasks complete

gibfahn added a commit to gibfahn/node that referenced this pull request May 28, 2017

readline: clean up event listener in onNewListener
Once the Readline interface is closed, the 'data' event listener should
be removed.

Refs: nodejs#9447 (comment)
@gibfahn

This comment has been minimized.

Show comment
Hide comment
@gibfahn

gibfahn May 28, 2017

Member

Note: This is automatically called by any readline instance on its input if the input is a terminal.

This seems to be correct looking at the code, so that part LGTM

Closing the readline instance does not stop the input from emitting 'keypress' events.

I'd rather fix this than document it (assuming it's a bug), see #13266

Member

gibfahn commented May 28, 2017

Note: This is automatically called by any readline instance on its input if the input is a terminal.

This seems to be correct looking at the code, so that part LGTM

Closing the readline instance does not stop the input from emitting 'keypress' events.

I'd rather fix this than document it (assuming it's a bug), see #13266

jasnell added a commit that referenced this pull request Jun 1, 2017

readline: clean up event listener in onNewListener
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>

jasnell added a commit that referenced this pull request Jun 5, 2017

readline: clean up event listener in onNewListener
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>
@addaleax

addaleax approved these changes Jun 8, 2017 edited

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).

@addaleax addaleax removed the stalled label Jun 8, 2017

@gibfahn

gibfahn approved these changes Jun 8, 2017

@addaleax

This comment has been minimized.

Show comment
Hide comment
@addaleax

addaleax Jun 10, 2017

Member

Landed in ac34779, thank you for the PR!

Member

addaleax commented Jun 10, 2017

Landed in ac34779, thank you for the PR!

@addaleax addaleax closed this Jun 10, 2017

addaleax added a commit that referenced this pull request Jun 10, 2017

doc: add readline.emitKeypressEvents note
PR-URL: #9447
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>

addaleax added a commit that referenced this pull request Jun 12, 2017

doc: add readline.emitKeypressEvents note
PR-URL: #9447
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>

@addaleax addaleax referenced this pull request Jun 12, 2017

Merged

v8.1.1 proposal #13598

@gibfahn gibfahn referenced this pull request Jun 15, 2017

Closed

Auditing for 6.11.1 #230

2 of 3 tasks complete
@MylesBorins

This comment has been minimized.

Show comment
Hide comment
@MylesBorins

MylesBorins Jul 17, 2017

Member

is this applicable to v6.x?

Member

MylesBorins commented Jul 17, 2017

is this applicable to v6.x?

MylesBorins added a commit that referenced this pull request Sep 19, 2017

doc: add readline.emitKeypressEvents note
PR-URL: #9447
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>

@MylesBorins MylesBorins referenced this pull request Sep 20, 2017

Merged

v6.11.4 proposal #15506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment