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

Down does not work on Windows #34

Closed
nojb opened this issue Apr 27, 2024 · 5 comments
Closed

Down does not work on Windows #34

nojb opened this issue Apr 27, 2024 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@nojb
Copy link
Contributor

nojb commented Apr 27, 2024

The package does not even compile at the moment:

$ dune build
Compilateur d'optimisation Microsoft (R) C/C++ version 19.39.33522 pour x64
Copyright (C) Microsoft Corporation. Tous droits réservés.

header_check.h
File "src/dune", line 7, characters 9-19:
7 |   (names down_stubs))
             ^^^^^^^^^^
down_stubs.c
down_stubs.c(8): fatal error C1083: Impossible d'ouvrir le fichier include : 'termios.h' : No such file or directory

Of course, this is a just a surface issue. The deeper issue is that Down is based on ANSI escape codes which are specific to UNIX. The Windows console is conceptually different and is controlled using system calls. Making Down work with on Windows would require, as far as I understand, a complete rewrite of anything that uses ANSI codes to make API calls instead (a fair amount of work).

I'm opening the issue following the discussion at https://discuss.ocaml.org/t/ann-down-0-2-0-and-omod-0-4-0/14380/5.

@dbuenzli dbuenzli added enhancement New feature or request help wanted Extra attention is needed labels Apr 27, 2024
@jonahbeckford
Copy link

jonahbeckford commented Apr 27, 2024

I did get 75% of the way porting down to run on Windows but ran out of time (and still don't have the time). The patches are available at https://gitlab.com/diskuv/DkHelloWorldActor/-/tree/main/dependencies/down https://gitlab.com/diskuv/share/down-win32.git

My git comment says: "Printable characters works, but not up and down arrows."

@dbuenzli
Copy link
Owner

I don't know what @jonahbeckford did (there's a login screen).

But:

The deeper issue is that Down is based on ANSI escape codes which are specific to UNIX.

Following a few links here and there it seems there is some kind of compatibility built in window. E.g.

https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences

Not sure if all sequences I use are supported but there is e.g. cursor movement.

@jonahbeckford
Copy link

Oops. Edited the link.

@nojb
Copy link
Contributor Author

nojb commented Apr 27, 2024

Following a few links here and there it seems there is some kind of compatibility built in window. E.g.

Indeed, thanks for the link. Could not resist using this to give it a shot after @jonahbeckford claimed that he had it almost working (but before he revealed his patch). It is not much, but I got something bare bones working: #35.

@dbuenzli
Copy link
Owner

dbuenzli commented Apr 30, 2024

Release 0.3.0 with Windows support is on the way to opam. Thank you all !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants