win32 icon indicating copy to clipboard operation
win32 copied to clipboard

Support for ReadConsoleInputW

Open chhackett opened this issue 1 year ago • 4 comments

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.

chhackett avatar Oct 12 '24 17:10 chhackett

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?

Mistuke avatar Oct 15 '24 01:10 Mistuke

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.

chhackett avatar Oct 15 '24 07:10 chhackett

Great, thank you!

Mistuke avatar Oct 16 '24 06:10 Mistuke

Just opened a PR: https://github.com/haskell/win32/pull/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%.

chhackett avatar Nov 18 '24 13:11 chhackett

This was added in #237.

bgamari avatar Jun 23 '25 19:06 bgamari