Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: note 'resize' event unreliability on Windows
  • Loading branch information
Dean-Coakley committed Jun 9, 2017
commit 6da59fec6cd0c0afe5edeb7d91daf929ea4a3601
3 changes: 3 additions & 0 deletions doc/api/tty.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@ or `writeStream.rows` properties have changed. No arguments are passed to the
listener callback when called.

```js
process.stdin.setRawMode(true);
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.

I think what @bzoz was saying in #13197 (comment) is that this line is needed on Windows, which implies it isn't needed on other platforms.

The code snippet without this sample works reliably in Unix, and even with this sample it's not reliable on Windows (#13197 (comment)), so I think it's probably best to just not include this (especially if this leads to people not being able to Ctrl+C their program).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's correct. (as far as I know) Removed. I don't think it's necessary to mention in commit messages since I both added and removed it?

process.stdout.on('resize', () => {
console.log('screen size has changed!');
console.log(`${process.stdout.columns}x${process.stdout.rows}`);
});
```

*Note:* Unrealiable event handler execution on all Windows platforms.
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.

  1. UnrealiableUnreliable
  2. What exactly do you want to say? Please try to use whole sentences if possible. Do you mean that the execution of this event is unreliable on Windows?

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.

How about something like:

*Note:*  Terminal window resize events are unreliable on Windows.

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.

@gibfahn As per your comment I would suggest to include a note about having to use setRawMode on Windows.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That seems much better. Is it ok as 2 commits or do I need to squash/rebase?

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.

This is a bit terse... can you expand this just a bit more?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I could add something like
Event handler only is only executed when the width is changed

It was also suggested here that raw mode must be enabled but I did not find this in my own testing.


### writeStream.columns
<!-- YAML
added: v0.7.7
Expand Down