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

Support for ReadConsoleInputW #236

Open
chhackett opened this issue Oct 12, 2024 · 4 comments
Open

Support for ReadConsoleInputW #236

chhackett opened this issue Oct 12, 2024 · 4 comments

Comments

@chhackett
Copy link
Contributor

There are several terminal based apps and libraries that have developed their own implementation of ReadConsoleInputW.
This function allows apps to provide support for reading console input including virtual terminal sequences on the Windows platform.
This is different from stdin which does not handle escape sequences.

It would be nice to consolidate these implementations in the Win32 library since these apps already use it for other purposes.

Example libraries/apps that use it:
vty-windows: https://github.com/chhackett/vty-windows/blob/main/src/Graphics/Vty/Platform/Windows/WindowsConsoleInput.hsc
haskeline: https://github.com/haskell/haskeline/blob/master/System/Console/Haskeline/Backend/Win32.hsc

I think there are one or two other examples out there.

This would allow library and app developers to remove duplicate code from their codebases and provide new functionality.

@Mistuke
Copy link
Contributor

Mistuke commented Oct 15, 2024

Hmm yeah agreed. I think vty's implementation is separate enough to pull in. It's license is compatible as well. I think you wrote it right @chhackett?

@chhackett
Copy link
Contributor Author

Yup, that was me. And that's the main motivation to get this into Win32, so I don't have to maintain that bit of code. :)
I'll get a PR put up in a few days for review. I think I saw some of the data types I need in Win32 already, so I'll make sure to re-use those.

@Mistuke
Copy link
Contributor

Mistuke commented Oct 16, 2024

Great, thank you!

@chhackett
Copy link
Contributor Author

chhackett commented Nov 18, 2024

Just opened a PR: #237

If you'd like me to update the changelog just let me know.

Or any other changes you'd like. I'm not sure I'm following your code standards 100%.

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

2 participants