Skip to content
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

Add MSYS2 or cygwin support #133

Closed
Swoorup opened this issue Nov 15, 2016 · 25 comments
Closed

Add MSYS2 or cygwin support #133

Swoorup opened this issue Nov 15, 2016 · 25 comments

Comments

@Swoorup
Copy link

Swoorup commented Nov 15, 2016

I would like to add support for mintty on windows. Would you what it would take? Or if there are any things blocking for this task?

@Swoorup Swoorup changed the title Add MSys2 or cygwin support Add MSYS2 or cygwin support Nov 15, 2016
@gdamore
Copy link
Owner

gdamore commented Nov 15, 2016

In theory this could be made to work using the XTerm escapes. However the things that would have to be added relate to dealing with changing the terminal into raw vs cooked mode. This is different on Windows as it lacks the termios ioctls.

@fawick
Copy link

fawick commented Nov 28, 2016

I found that prefixing with winpty made tcell-using code usable for me in MSYS2, e.g.

cd $GOPATH/src/github.com/gdamore/tcell/_demos
go build boxes.go
winpty ./boxes.exe

@ErichDonGubler
Copy link

@gdamore: I might be interested in delving into this, could you point me to some more details on what be necessary to implement the changes?

@gdamore
Copy link
Owner

gdamore commented May 24, 2017

Well, I don't know how winpty works. That might be a starting point. The issue is that terminal handling (stty modes really) have to be made to work. Frankly, this seems ... backwards; a better solution would be to figure out if we can use a more "correct" method of dealing with the terminal on these systems -- like we do with a native Win32 API.

@TheNicholasNick
Copy link

TheNicholasNick commented Mar 24, 2018

performance wise, winpty kind of sucks

  • cmd.exe > boxes.exe = 1.718ms / box
  • git-bash.exe > mintty.exe > winpty boxes.exe = 2.916 ms / box

(looks like neither can track the mouse using the demo app)

@gdamore
Copy link
Owner

gdamore commented Mar 24, 2018 via email

@E3V3A
Copy link

E3V3A commented Feb 2, 2019

I don't think the difference of ~1 ms for a one time operation as a performance issue. Not fixing the issue though, is a definite performance issue. (I've never had any performance issues with Mintty, unlike the many iterations of CMD, PS, PWSH, etc.)

So what is the current status on this?

@gdamore
Copy link
Owner

gdamore commented Feb 2, 2019

well you can use winpty now.

@gdamore
Copy link
Owner

gdamore commented Feb 2, 2019

btw that is 1ms per box. not a one time operation. out another way winpty adds about 50 percent or more to the cost of drawing on screen.

@gdamore
Copy link
Owner

gdamore commented Mar 19, 2019

This might be better in master now -- at least if $TERM is set, even on Windows, tcell no longer crashes out. You do need to have a terminal that supports the real Windows console API though.

I'm looking at alternatives for the future -- because with Windows 10 it seems like we might want to support xterm style escape sequences in order to access the larger color space.

@aadrian
Copy link

aadrian commented Jul 20, 2020

Cygwin support would be very helpful. e.g. https://github.com/zyedidia/micro#cygwin-mingw-plan9 depends on this project.

@gdamore
Copy link
Owner

gdamore commented Aug 30, 2020

I still can't fathom why anyone would continue to use Mintty. It's usefulness is rather severely limited since it cannot support generic Windows console applications.

@ErichDonGubler
Copy link

@gdamore: I can tell you why I use it, and that's because a *nix-like environment in Windows is a nice way to get some of the large *nix ecosystem. I have used Windows most of my life as a professional and as a casual user, and I still prefer POSIX tools to the default Windows tools when developing cross-platform projects. I'm also a huge terminal nerd with all of the associated demand for easy scripting and avoiding specialized binary tools where reasonable, so that contributes enormously. :)

@gdamore
Copy link
Owner

gdamore commented Aug 31, 2020

@ErichDonGubler that's all fine, you can use cygwin or msys tools from a normal Windows 10 console host, or the new Windows 10 Terminal app, as well as a number of third party consoles (e.g. ConEmu).

My specific complaint/issue is with mintty -- which implements only the POSIX TTY semantics and not the Windows console API. This means it can only be used with pure POSIX tools. Unfortunately, that's not tcell, as tcell attempts to be savvy about Windows vs. Linux.

You can work around this with winpty, which adds the missing semantics to mintty.

However, I would strongly advise trying out another terminal app. Anything you choose will almost certainly be an upgrade over mintty. (Back before Windows 10, having mintty was nice because it offered better support for resizing and tabbed usage. That was enough for some users to overcome it's other deficiencies. Since then numerous other options are available, and Microsoft has addressed the relevant short-comings in their own apps. In this day and age there are no benefits to mintty -- only limitations. From what I can tell, the mintty itself is largely abandonware, as they haven't addressed any of the short-comings.)

@ErichDonGubler
Copy link

ErichDonGubler commented Nov 7, 2020

@gdamore:

However, I would strongly advise trying out another terminal app. Anything you choose will almost certainly be an upgrade over mintty.

Having tried the new Windows Terminal since your suggestion, and several other apps before (PuTTY, ConEmu, cmder), I've yet to find an alternative that fully supports VT100 escapes, esp. mouse interactions. That might sound odd, coming from a terminal freak like myself, but using a pointer device with terminals is a big flow booster for me. So, naturally, I disagree that other options are universally better, and given that the MinTTY project still regularly puts out releases, I reject this notion of yours:

In this day and age there are no benefits to mintty -- only limitations. From what I can tell, the mintty itself is largely abandonware, as they haven't addressed any of the short-comings.

@gdamore
Copy link
Owner

gdamore commented Nov 7, 2020

I'd be curious to know what escapes aren't supported. I've found no issues and the modern terminal is a pretty close xterm implementation. It does include support for mouse escapes (which actual vt100 of course does not.)

@gdamore
Copy link
Owner

gdamore commented Nov 7, 2020

You do need to set TERM of course.

@gdamore
Copy link
Owner

gdamore commented Nov 7, 2020

There was just recently a mintty release. After over a 3 year hiatus. The fails for my definition of regular releases and may explain why I assumed it was abandonware.

@ErichDonGubler
Copy link

ErichDonGubler commented Nov 7, 2020

@gdamore:

It does include support for mouse escapes (which actual vt100 of course does not.)

Sorry, I didn't mean VT100 escapes in the sense of the original device (which is the most sensible interpretation); my terminology was probably more offhanded than accurate. Apologies. :)

I'd be curious to know what escapes aren't supported.

Most escapes seemed to work just fine, though I've had Unclear Weirdness™ with random ANSI escapes from some tools I use regularly (which I can list if you care); mouse escapes are the major ones I noticed not working (which I use a lot for vim and tmux). If you're interested, I'm more than happy to take that discussion offline.

You do need to set TERM of course.

I know I tried explicitly setting the TERM environmental variable in some situations, but my testing wasn't that rigorous. This might be an interesting lead.

There was just recently a mintty release. After over a 3 year hiatus. The fails for my definition of regular releases and may explain why I assumed it was abandonware.

Huh? Are we talking about the same project? There are 10 releases alone on the first page of the MinTTY Releases link I used above, all no earlier than February of this year, with an average of a few weeks between releases. A regular release cadence with gaps of at most a few months has been maintained since 2016 (maybe longer -- I abandoned looking further after going that far, since it goes longer than the 3 years you mention).

@gdamore
Copy link
Owner

gdamore commented Nov 7, 2020

Huh. Going back I think I misread Sep 17 and Sep 2017... Lol. My apologies for that - it's what I get for looking at that link on a phone instead of a real computer.

As to mouse events; they Just Work. I use WSL sometimes, and tcell running under WSL, in a windows terminal, works fine. Mouse events including live mouse tracking Just Works. And because that's under WSL, its using plain old xterm escape sequences for mouse reporting.

You can test this yourself by using a WSL session, the Windows 10 Terminal app, and then doing "go run _demos/mouse.go"

This also works reasonably well (at least the last time I tried) under conemu. (Conemu may struggle with 24-bit colors.)

I have found no case where Windows Terminal is deficient relative to other terminals in escape sequence handling. Indeed, these days it even supports 24-bit color using XTerm escapes.

Much more likely is that you have some applications which were built to only work with mintty's magical emulation of a Linux terminal system -- most specifically terminfo (think stty). Yeah, Windows doesn't have that (although WSL does). Those applications aren't going to work in anything except a mintty environment. But you should consider running them in WSL instead -- your life will improve if you do.

The only issues I've found in Windows terminal recently have been related some incomplete Unicode fonts. Unless you're using unusual characters (typically things like combing glyphs or newer Unicode glyphs) you're unlikely to even notice. (Support for this under Linux terminals is also varied, and I'd be surprised if mintty got this all correct.) The Microsoft team has worked hard to update the Terminal app to provide all the usual bells and whistles and compatibility that folks coming from a Linux background should expect, and I think they've done a good job.

In fact, if you're using many Linux apps, I highly recommend WSL. It's a far more natural experience than the hackery that is attempting to run mingw apps. (It's a much more complete emulation of Linux, regardless of whether you use WSL 1 or WSL 2.)

Minsys is an attempt to be a hybrid of both Windows and Linux, and in my opinion it simply brings the worst of both worlds; it's a compromise that maybe once made sense, but is no longer needed in this day and age.

@gdamore
Copy link
Owner

gdamore commented Nov 7, 2020

For now I'm closing this issue. I'm not interested in doing this. If someone can provide a simple solution (I don't think one exists) for this problem I'm happy to reconsider. I'm distinctly not interested in building a substantial amount of code just for mintty or to workaround the deficiencies in mintty.

I suggest folks that really, really want mintty to work better with native Windows console apps ask the mintty people to look at implementing the Win32 console API. Good luck with that!

@gdamore gdamore closed this as completed Nov 7, 2020
@gdamore
Copy link
Owner

gdamore commented Jan 24, 2021

Latest mintty seems to Just Work. It doesn't support mouse interaction, but the rest of it works well enough.

@ErichDonGubler
Copy link

ErichDonGubler commented Jan 25, 2021

I have further feedback in response to #133 (comment) (TL;DR: there are some fundamental limitations of WSL1/2 workflow that are interesting to note as caveats, part. file I/O being a sore point for performance in WSL2) that I haven't taken time to draft yet, but for now, I'm interested in clarifying:

Latest mintty seems to Just Work. It doesn't support mouse interaction, but the rest of it works well enough.

@gdamore: You're referring to the MinTTY 3.4.4 that was released last month, then? At time of writing, that's the latest release. Or...maybe you're referring to bleeding edge commits? I'm not sure.

@gdamore
Copy link
Owner

gdamore commented Jan 25, 2021 via email

@ErichDonGubler
Copy link

So, there's been an MinTTY release since the last few comments (3.4.5), which leads me to believe that the version of MinTTY you were referring to is in the history of whatever ended up being released. However, none of the _demo entries in the repo are working on that version of MinTTY. Could it be that there's some other setup going on, like Go programs being compiled differently?

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

No branches or pull requests

7 participants