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

Windows :terminal #7007

Merged
merged 16 commits into from Aug 16, 2017

Conversation

Projects
None yet
6 participants
@justinmk
Member

justinmk commented Jul 12, 2017

Rebase #6383
Closes #4748

  • remove b393963 (libuv was upgraded in e8aa589)
  • add a commit that reverts the CTRL-Q workaround in tty-test.c: so far SIGWINCH actually seems to work much better than the CTRL-Q workaround, and doesn't add 3 minutes to the tests.
    • update: per the libuv docs, SIGWINCH usually won't fire unless the cursor is moved by the window resize. So we force this by placing the cursor near the last line, and shrinking the window.

@marvim marvim added the WIP label Jul 12, 2017

@justinmk justinmk changed the title from [WIP] Windows :terminal to [RFC] Windows :terminal Aug 7, 2017

@justinmk justinmk changed the title from [RFC] Windows :terminal to Windows :terminal Aug 7, 2017

@justinmk

This comment has been minimized.

Member

justinmk commented Aug 13, 2017

@erw7 Some issues I noticed:

  • the alternate screen doesn't seem to be used, so starting an interactive app like nvim.exe in a :terminal will show the scrollback if one scrolls up in the :terminal buffer
  • nvim.exe inside :terminal only uses 8 colors. :echo &t_Co returns 8 also.
@erw7

This comment has been minimized.

Contributor

erw7 commented Aug 13, 2017

@justinmk I think they are nvim's tui issue. Since libuv's tty emulation supports only the basic ansi escape sequence, I think it is necessary to change libuv's tty.c and nvim's tui.c.

@justinmk

This comment has been minimized.

Member

justinmk commented Aug 13, 2017

Ah, ok. Guess we should learn from what Vim is doing with their integration of :terminal and winpty on Windows.

This is a good start. Thanks again.

rprichard and others added some commits Feb 24, 2016

win: integrate winpty (WIP)
Handling of process exit is still broken.  It detects the moment when the
child process exits, then quickly stops polling for process output.  It
should continue polling for output until the agent has scraped all of the
process' output.  This problem is easy to notice by running a command like
"dir && exit", but even typing "exit<ENTER>" can manifest the problem --
the "t" might not appear.

winpty's Cygwin adapter handles shutdown by waiting for the agent to close
the CONOUT pipe, which it does after it has scraped the child's last
output.  AFAIK, neovim doesn't do anything interesting when winpty closes
the CONOUT pipe.
win/pty: jobstart, jobstop: fix null-pointer dereference
- Make sure that proc->in is not NULL, because nvim crashed when
  starting a job with pty.
- Make sure that proc->out is not NULL, because nvim crashed when stopping
  a job opened with pty.
win/test: tty-test: print screen size explicitly with CTRL-Q
tty-test.exe causes abnormal termination with low repeatability, try
changing it so as not to use SIGWINCH.
win/test: enable more :terminal tests
To deal with SIGWINCH limitations on Windows, change some resize tests
to _shrink_ the screen width. ... But this didn't work, so still
ignoring those tests on Windows.
test: tty-test.c: keep `tty_out` handle around
Now the window_split_tab_spec.lua test seems to work.
Also do some cleanup.

@justinmk justinmk merged commit 5b32bce into neovim:master Aug 16, 2017

3 checks passed

QuickBuild Build pr-7007 finished with status SUCCESSFUL
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@justinmk justinmk deleted the justinmk:winterm branch Aug 16, 2017

@justinmk justinmk removed the WIP label Aug 16, 2017

@jonathanslenders

This comment has been minimized.

jonathanslenders commented Aug 17, 2017

WOW, I just came across this! This is really amazing!

Is there any writeup of how this was realized? (I know how this works on Linux.)
I'm the author of pyvim and pymux, and this would help me implement both a terminal for pyvim as well as making the pymux multiplexer work on Windows.

Thanks a lot!
Jonathan

@justinmk

This comment has been minimized.

Member

justinmk commented Aug 17, 2017

@jonathanslenders see pty_process_win.c. Vim 8 is doing something similar, so there are now multiple implementations for reference.

I know how this works on Linux

winpty provides the magic, it implements a POSIX-like pty object.

@prabirshrestha

This comment has been minimized.

prabirshrestha commented Aug 17, 2017

Great to see this finally working on windows. Would love to have pymux working on windows.

Here is the issue I filed back in tmux for windows support tmux/tmux#1029

justinmk added a commit to justinmk/neovim that referenced this pull request Aug 20, 2017

Revert "Merge neovim#7007 'Windows :terminal'"
This reverts commit 5b32bce, reversing
changes made to cea1248.

justinmk added a commit to justinmk/neovim that referenced this pull request Nov 8, 2017

NVIM v0.2.1
FEATURES:
0e873a3 Lua(Jit) built-in neovim#4411
5b32bce Windows: `:terminal` neovim#7007
7b0ceb3 UI/API: externalize cmdline neovim#7173
b67f58b UI/API: externalize wildmenu neovim#7454
b23aa1c UI: 'winhighlight' neovim#6597
17531ed UI: command-line coloring (`:help input()-highlight`) neovim#6364
244a1f9 API: execute lua directly from the remote api neovim#6704
45626de API: `get_keymap()` neovim#6236
db99982 API: `nvim_get_hl_by_name()`, `nvim_get_hl_by_id()` neovim#7082
dc68538 menu_get() function neovim#6322
9db42d4 :cquit : take an error code argument neovim#7336
9cc185d job-control: serverstart(): support ipv6 neovim#6680
1b7a9bf job-control: sockopen() neovim#6594
6efe84a clipboard: fallback to tmux clipboard neovim#6894
6016ac2 clipboard: customize clipboard with `g:clipboard` neovim#6030
3a86dd5 ruby: override ruby host via `g:ruby_host_prog` neovim#6841
16cce1a debug: $NVIM_LOG_FILE neovim#6827
0cba3da `:checkhealth` built-in, validates $VIMRUNTIME neovim#7399

FIXES:
105d680 TUI: more terminals, improve scroll/resize neovim#6816
cb912a3 :terminal : handle F1-F12, other keys neovim#7241
619838f inccommand: improve performance neovim#6949
04b3c32 inccommand: Fix matches for zero-width neovim#7487
60b1e8a inccommand: multiline, other fixes neovim#7315
f1f7f3b inccommand: Ignore leading modifiers in the command neovim#6967
1551f71 inccommand: fix 'gdefault' lockup neovim#7262
6338199 API: bufhl: support creating new groups neovim#7414
541dde3 API: allow K_EVENT during operator-pending
8c732f7 terminal: adjust for 'number' neovim#7440
5bec946 UI: preserve wildmenu during jobs/events neovim#7110
c349083 UI: disable 'lazyredraw' during ui_refresh. neovim#6259
51808a2 send FocusGained/FocusLost event instead of pseudokey neovim#7221
133f8bc shada: preserve unnamed register on restart neovim#4700
1b70a1d shada: avoid assertion on corrupt shada file neovim#6958
9f534f3 mksession: Restore tab-local working directory neovim#6859
de1084f fix buf_write() crash neovim#7140
7f76986 syntax: register 'Normal' highlight group neovim#6973
6e7a8c3 RPC: close channel if stream was closed neovim#7081
85f3084 clipboard: disallow recursion; show hint only once neovim#7203
8d1ccb6 clipboard: performance, avoid weird edge-cases neovim#7193
01487d4 'titleold' neovim#7358
01e53a5 Windows: better path-handling, separator (slash) hygiene neovim#7349
0f2873c Windows: multibyte startup arguments neovim#7060

CHANGES:
9ff0cc7 :terminal : start in normal-mode neovim#6808
032b088 lower priority of 'cursorcolumn', 'colorcolumn' neovim#7364
2a3bcd1 RPC: Don't delay notifications when request is pending neovim#6544
023f67c :terminal : Do not change 'number', 'relativenumber' neovim#6796
1ef2d76 socket.c: Disable Nagle's algorithm on TCP sockets neovim#6915
6720fe2 help: `K` tries Vim help instead of manpage neovim#3104
7068370 help, man.vim: change "outline" map to `gO` neovim#7405

@justinmk justinmk referenced this pull request Nov 8, 2017

Merged

NVIM v0.2.1 #7505

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