gdamore / tcell

Tcell is an alternate terminal package, similar in some ways to termbox, but better in others.
Apache License 2.0
4.56k stars 308 forks source link

mouse events on windows 10 cmd.exe ignored #182

Closed glycerine closed 6 years ago

glycerine commented 6 years ago

Hi Garrett!

I ran proxima5 as a test case for tcell Windows 10. On Windows 10, running proxima5 under cmd.exe, mouse clicks create a cursor on the screen, but they don't jump the view to a new part of the territory like they do on OSX. So I suspect that the full mouse event isn't being received by the application.

echo %TERM% reports nothing, so no "TERM" env variable appears set.

Let me know if I can try anything else here.

Jason

gdamore commented 6 years ago

Thanks. I will take a look. On Sun, Dec 31, 2017 at 2:17 PM Jason E. Aten, Ph.D. < notifications@github.com> wrote:

Hi Garrett!

I ran proxima5 as a test case for tcell Windows 10. On Windows 10, running proxima5 under cmd.exe, mouse clicks create a cursor on the screen, but they don't jump the view to a new part of the territory like they do on OSX. So I suspect that the full mouse event isn't being received by the application.

echo %TERM% reports nothing, so no "TERM" env variable appears set.

Let me know if I can test anything else here.

Jason

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gdamore/tcell/issues/182, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPDfes165SgJ5qQIldXINHm8B6oY9NBks5tGAfpgaJpZM4RP8c_ .

glycerine commented 6 years ago

I can confirm that this is a problem with the cmd.exe program itself. Even with "QuickEdit" mode on (which I had on before, and typically do have on by default so that right-click paste works), mouse events were not being passed to the program. I think this is primarily because cmd.exe was not designed to be a terminal emulator [1].

In contrast, when I download and use an actual terminal emulator for windows, ComEmu (from https://www.fosshub.com/ConEmu.html; namely https://www.fosshub.com/ConEmu.html/ConEmuSetup.161206.exe ), then mouse events come through just fine, and proxima5 view change works as on OSX, and my debug logging of NewMouseEvent() fills the log file with output as it should when all is working as expected.

The only thing that remains a mystery to me is this: did anyone ever get mouse events to work under cmd.exe? If so, how? I would be quite surprised. (Update: this turned out to be wrong, see below)

[1] background reading:

https://stackoverflow.com/questions/31085853/is-cmd-exe-a-shell-a-terminal-emulator-or-both

glycerine commented 6 years ago

Console2, another improvement on cmd.exe, also sends mouse clicks through just fine. http://sourceforge.net/projects/console/files/

I tried PowerShell from M$ but no go. Both powershell.exe and cmd.exe freeze the display when the mouse is clicked, and resume it when any key is pressed. In neither case are mouse events passed through to the proxima5.exe.

update: apparently the freeze is a side-effect of quickedit mode.

https://stackoverflow.com/questions/33883530/why-is-my-command-prompt-freezing-on-windows-10

glycerine commented 6 years ago

cygwin claims to be TERM=xterm and vi works; but I don't think tcell knows what to do with an xterm on windows (proxima5 runs fine with mouse events under a linux xterm, of course, so maybe some database entry is needed for windows). Running proxima5.exe in cygwin stops immediately with

cygwin:

$ ./proxima5.exe
Failed to initialize game: character set not supported

$ echo $TERM
xterm

$
glycerine commented 6 years ago

AH HAH! It was the QuickEdit mode!

If I turn off QuickEdit mode, then mouse clicks, under cmd.exe, are passed through to the application.

Not to users: if you have QuickEdit mode on by default, you may have to turn it off again after you start your application.

Update: for those unfamiliar, turning off QuickEdit mode involves: right-click on the control bar of the cmd.exe window, select Properties, then under Edit options, uncheck the box for Quick Edit Mode. Reference with picture:

https://stackoverflow.com/questions/33883530/why-is-my-command-prompt-freezing-on-windows-10

gdamore commented 6 years ago

glad you figured it out!!! On Sun, Dec 31, 2017 at 5:38 PM Jason E. Aten, Ph.D. < notifications@github.com> wrote:

AH HAH! It was the QuickEdit mode!

If I turn off QuickEdit mode, then mouse clicks, under cmd.exe, are passed through to the application.

Not to users: if you have QuickEdit mode on by default, you may have to turn it off again after you start your application.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/gdamore/tcell/issues/182#issuecomment-354632457, or mute the thread https://github.com/notifications/unsubscribe-auth/ABPDfaOOUviUpEuC5R4AZt9uF4uSBOSYks5tGDcXgaJpZM4RP8c_ .