-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Interpreter reply #12738
Interpreter reply #12738
Conversation
Thank you for this! Here's a quick feedback. I'm on Mac OSX (M1). I just compiled this branch in release mode with the interpreter. I run
Any ideas? Probably something that computes the line height isn't implemented well for Mac OSX? |
A bit more. This program: require "reply"
p Reply::Term::Size.size Gives me this:
|
Is there a default terminal size that could be used? I'm thinking it could maybe use a default if that function failed, maybe printing something to STDOUT information about this to the user. But of course fixing the issue might take a bit more time but solve the issue better. |
It doesn't set Your lib LibC
struct Winsize
row : LibC::UShort
col : LibC::UShort
x_pixel : LibC::UShort
y_pixel : LibC::UShort
end
TIOCGWINSZ = # ...
fun ioctl(fd : Int, request : ULong, ...) : Int
end
screen_size = uninitialized LibC::Winsize
LibC.ioctl(1, LibC::TIOCGWINSZ, pointerof(screen_size)) |
Thank you a lot @HertzDevil! After some recherche, I find this awesome file created by @watzon which seem to handle every case! In case of failure it fallback on several alternatives including |
I bring a new implementation of |
I have also fixed a spec broken on Windows due to |
It's working great now. This is awesome! ❤️ |
…when the size is taken from `tput` (if `ioctl` fails).
Hey @I3oris, this PR is still in draft. Is there anything substantial missing? If you know there are missing bits, what's necessary to fill them? |
Hello @straight-shoota ! Yeah I think it's ready to be merged, apart from one thing (but I didn't got the time to share it, neither to solve it yet, so I'm a bit sorry for the delays). The thing is the Ideally, But the only reason the interpreter need To solve this I thinks we could do either:
|
I think it would eventually make much sense to have the debugger action pluggable (option 2.) |
I agree. The goodies in this PR are greater than the mentioned issue. This PR is fantastic! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I didn't dive into the details of the lib implementation. I trust that it works and makes sense from what I have been able to observe.
It should be great to get it merged and then we'll be able to iron out any issues detected while using it.
Thank you very much @I3oris for this library and its integration 🎉
Dear crystal team.
I bring in this PR, at last, the integration of the shard
REPLy
as a term reader for the interpreter. The main purpose of it is to be an alternative toreadline
, that work on windows (#11340).In addition, this shard is pure crystal and could be adjusted to fit exactly the compiler need.
Concretely, this PR adds the following things using the REPLy features:
interpreter/repl_reader.cr
.if
. I think the patch for this could be added later)pry
atinterpreter/pry_reader.cr
.ctrl-down
=>next
ctrl-left
=>step
ctrl-right
=>finish
That's it. I hope everything is OK with this PR, don't hesitate to let me know in the comments for any question, improvement or typo.
Thank you much all! 😀