Im-Beast / deno_tui

🦕 Deno module for creating Terminal User Interfaces
https://deno.land/x/tui
MIT License
266 stars 18 forks source link

[💡FEAT. REQ. ] Windows support (SIGWINCH not supported on Windows) #3

Closed soshimee closed 2 years ago

soshimee commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and SIGWINCH is not supported on Windows.

Describe the solution you'd like Use alternative to SIGWINCH on Windows.

Describe alternatives you've considered Using blessed, but it doesn't work on Deno.

Additional context

error: Uncaught Error: not implemented
  Deno.addSignalListener("SIGWINCH", () => {
       ^
    at Object.opSync (deno:core/01_core.js:177:12)
    at bindSignal (deno:runtime/js/40_signals.js:13:17)
    at Object.addSignalListener (deno:runtime/js/40_signals.js:53:21)
    at createCanvas (https://deno.land/x/tui@0.5.1/src/canvas.ts:122:8)
    at createTui (https://deno.land/x/tui@0.5.1/src/tui.ts:195:12)
Im-Beast commented 2 years ago

Hi!

I haven't tested deno_tui compatibility with Windows yet, when I'll have some more time I will look into it, hopefully even today or tomorrow.

Deno would have to implement SIGWINCH signal for windows, however I think I know how to implement temporary workaround :)

Im-Beast commented 2 years ago

Hello,

I've implemented workarounds and deno_tui should work on windows just fine on the next release. Remember to make cmd/powershell use UTF-8 using chcp 65001 command. Keep in mind that mouse won't work and keyboard controls have been changed to use ijkl instead of up, left, down and right arrows (because windows commandlines don't send them to stdin for some reason). I've yet to try WSL and maybe it fixes problems that I've described.

Feel free to open issues if you notice any bugs!

DefinitelyMaybe commented 2 years ago

Howdy,

Looking at trying to make something with this but ran into the following:

error: TypeError: Windows only supports ctrl-c (SIGINT) and ctrl-break (SIGBREAK).
    at Object.opSync (deno:core/01_core.js:170:12)
    at bindSignal (deno:runtime/js/40_signals.js:13:17)
    at Object.addSignalListener (deno:runtime/js/40_signals.js:53:21)
    at createCanvas (https://deno.land/x/tui@0.5.1/src/canvas.ts:122:8)
    at createTui (https://deno.land/x/tui@0.5.1/src/tui.ts:195:12)
    at file:///C:/Users/rekke/Documents/PlayingCourt/server/main.js:77:13

tried running chcp 65001 and re-ran but no change to error message.

Im-Beast commented 2 years ago

This module is still WIP and right now under complete rework, so not everything is complete yet, including windows support (which will be added). I expect 1.0 version being available soon(ish), maybe in the week or two.