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

Add Raw Mode Support #175

Merged
merged 45 commits into from
Jun 16, 2024
Merged

Add Raw Mode Support #175

merged 45 commits into from
Jun 16, 2024

Conversation

ajalt
Copy link
Owner

@ajalt ajalt commented Jun 15, 2024

Raw mode is supported on all targets except JS and wasm, although there are node/browser APIs to read similar events. I also couldn't get Graal nativeimage working, although that could be added in the future.

select_list

I used to wonder why Jline supports raw mode but all you can do with it is read raw bytes from stdin. But after wading into the mess of parsing VTI escape sequences, I can see why they tapped out. But I'm not willing to push that pain onto users, so I parse all the VTI sequences I can find into InputEvent data classes. You can still read raw bytes from stdin instead if you want.

Fixes #173
Fixes #133
Fixes #89
Fixes #33

@ajalt
Copy link
Owner Author

ajalt commented Jun 15, 2024

Well, that was a lot of work. Mordant targets JVM/jna, JVM/nativeimage, KT/Native, JS, and wasmJS. Multiply that by three operating systems, and any time you touch a syscall you need to implement it a dozen times.

@Jonathan-Zollinger
Copy link

what was the trouble around compiling with graal ? I remember having a beast of a time getting pico to compile to graal, but I eventually got it working. Is this something I could help with?

@ajalt
Copy link
Owner Author

ajalt commented Jun 15, 2024

I'd love help if you want to take a look.

The problem is actually kind of silly, but I couldn't figure out how to represent the tcgetattr/tcsetattr functions with graal's FFI annotations. If you uncomment the code in SyscallHandler.nativeimage.posix.kt and SyscallHandler.nativeimage.windows.kt and can get it to compile under nativeimage, that should be all that's required.

@Jonathan-Zollinger
Copy link

no guarantees I can actually figure anything out! bug I love the challenge! dont wait up on me, I'm not sure when I'll get to this, but I will get to it!

@ajalt ajalt merged commit 23c9ba4 into master Jun 16, 2024
4 checks passed
@ajalt ajalt deleted the raw-mode branch June 16, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants