Skip to content

Fix Windows compilation for Crystal 1.13+#7

Merged
I3oris merged 1 commit intoI3oris:mainfrom
HertzDevil:fix-windows
Aug 27, 2024
Merged

Fix Windows compilation for Crystal 1.13+#7
I3oris merged 1 commit intoI3oris:mainfrom
HertzDevil:fix-windows

Conversation

@HertzDevil
Copy link
Contributor

@HertzDevil HertzDevil commented Aug 27, 2024

Some of the internal definitions are no longer necessary and clash with a newer stdlib, especially crystal-lang/crystal#14501 which replaces C file descriptors with their underlying Win32 handles.

spec/reader_spec.cr will run on Windows too, however it lacks the proper fiber synchronization. Also it appears REPLy expects the input to use \r\n on Windows only, but the specs do not account for that.

What was the reason behind making Ctrl+Enter exclusive to Windows? Isn't it easier to just strip the CRLF sequences at the beginning of Reply::CharReader#parse_escape_sequence?

@I3oris I3oris merged commit db423da into I3oris:main Aug 27, 2024
@I3oris
Copy link
Owner

I3oris commented Aug 27, 2024

Hello HertzDevil,

Thank you for this merge request!

In effect, spec/reader_spec is now running, but it needs to be fixed on Windows.

On Linux, the alt-enter shortcut allows users to input a new line without submitting the input. However, on Windows, this shortcut puts the terminal in fullscreen mode, and it seems impossible to change this behavior. That's why I implemented the shortcut on ctrl-enter on Windows. However, on Linux, ctrl-enter cannot be distinguished from enter because they share the same key code. Ditto for shift-enter.

@HertzDevil
Copy link
Contributor Author

Alt+Enter can be disabled in Windows Terminal, not sure about the older console host

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

Successfully merging this pull request may close these issues.

2 participants