Skip to content

[RFC] Fix stall before starting tui when something is output in Windows #9825

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

Closed
wants to merge 4 commits into from
Closed

[RFC] Fix stall before starting tui when something is output in Windows #9825

wants to merge 4 commits into from

Conversation

erw7
Copy link
Contributor

@erw7 erw7 commented Apr 1, 2019

fixes #7967

@marvim marvim added the RFC label Apr 1, 2019
@erw7
Copy link
Contributor Author

erw7 commented Apr 1, 2019

I don't know if it's really all right, but is it better to fix stream_init() like 6589f6f?

@justinmk
Copy link
Member

justinmk commented Apr 1, 2019

I don't know if it's really all right, but is it better to fix stream_init() like 6589f6f?

That seems slightly better to me, if this is something that's always required for streams on Windows.

But for #7967 I think the best approach is to simply not print anything until startup is ready, as @bfredl mentioned. Alternatively, collect messages in a list which is later printed.

@erw7
Copy link
Contributor Author

erw7 commented Apr 1, 2019

I do not understand exactly what it does, but I implemented it referring to the embedded case. The behavior is different from vim(A message is displayed after the screen is cleared, but on vim a message is displayed before the screen is cleared), but it seems to be working. This closes because I created #9829.

@erw7 erw7 closed this Apr 1, 2019
@justinmk justinmk removed the RFC label Apr 1, 2019
This reverts commit b860d05.
@erw7 erw7 reopened this Apr 2, 2019
@marvim marvim added the RFC label Apr 2, 2019
erw7 added 2 commits April 2, 2019 19:10
Change to use COIN$ for reading when using stdin for command reading on
Windows.
rstream_init_fd(loop, &input->read_stream, input->in_fd, 0xfff);
#ifdef WIN32
uv_tty_set_mode(&input->read_stream.uv.tty, UV_TTY_MODE_RAW);
Copy link
Member

Choose a reason for hiding this comment

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

why not do this in stream_init ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All current calls need to do uv_tty_set_mode(..., ..., UV_TTY_MODE_RAW), so I think that's fine. There may be calls that do not need it, so I did not.

#ifdef WIN32
int fd;
HANDLE conin_handle = INVALID_HANDLE_VALUE;
#endif
if (reading_tty || reading_excmds) {
// One of the startup commands (arguments, sourced scripts or plugins) may
// prompt the user, so start reading from a tty now.
Copy link
Member

Choose a reason for hiding this comment

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

This is the special-case that would be really nice to eliminate. So if we can eliminate this with #9829 , then #9829 is worth doing.

If we're going to show prompts to the user we might as well wait for the UI starts, rather than having special cases before the UI starts.

justinmk pushed a commit that referenced this pull request Apr 28, 2019
@erw7 erw7 closed this May 30, 2019
@erw7 erw7 deleted the fix-stall-before-tui-start-on-windows branch September 11, 2019 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows/TUI: Printing to stdout during initialization prevents starting normally
3 participants