Closed AntimatterReactor closed 2 years ago
Yeah, that's what happened when i pressed the arrow keys...
That appears to be platform independent, doesn’t happen to me
Hi, thanks for opening an issue!
The REPL was created in a bit of a hurry, and isn't very polished. I'm planning on adding something like Readline (update: probably going to use Rustyline if I come around to this) to it so that you get a better experience. You will see those characters since we're not setting the pseudoterminal to raw mode, and the line discipline will echo the keypresses like that by default.
@cursorweb You won't see this on Windows or any system that doesn't use ANSI terminal with a stty line discipline. When Windows support is required, one will either need to use the new ANSI-emulation features of Windows terminals or with a specialised library. (Also "platform-independent" means it's on everything, "regardless of platform" :P)
@19wintersp I think using a better STDIN library is a good thing, as it doesn’t seem like a super hard thing to add. It will also make Europa look at little more polished, which is going to look good for the Lang!
@darkdarcool Just to be clear - Readline/Rustyline isn't a "STDIN library"; they're designed for basic text processing, completion, and interaction with the pseudoterminals and IO that we don't want to deal with ourselves. It's also not just a drop-in replacement: I'll have to do some testing with certain features as well as consulting the project leads with the nature of the REPL (though I do have a system which I'd like to use). Whilst I agree that having a better REPL will make the interpreter program itself feel more polished, more work is required on the language itself to make it anywhere near looking good - not least of which the current bugs with loops.
@19wintersp Sorry, that's kinda what I meant by STDIN, because that's the only word that I could think of(lmao). But either way I think this is a good addition that we can make a pr for.
@darkdarcool I will attempt to work on this, but it will take time; I can't create a PR from thin air. If you'd like to work on this, please feel free to do so.
@19wintersp, since this is a reliably simple thing, I'm totally ok with making a pr for this. I'll make a repl because my main computer is currently being replaced. I'll make sure to invite you to it. And this conversation can continue in discord so we don't spam this thread with messages
@darkdarcool I'd warn against considering this "reliably simple" - I trust your comprehension of the subject. I'm currently busy with other projects, so I will not be able to work on this with you.
@19wintersp oops typo lol and yeah sure, I have no idea how that bug comes from xd
Also, another note on this thread in general: bracket-matching would be a nice feature to have, so that typing if true {
and pressing enter will allow you to continue with that until the bracket is paired and closed. This may need some thought as to ignore brackets in comments and the like.
@19wintersp, I'm just looking to add the basics currently. Nothing large. If something goes wrong, I can simply revert to original code and try again.
ok seems like we need to make a more dedicated issue for this
move to #26 please
@darkdarcool To be clear, by "Readline" I'm referring to GNU Readline. When you are writing this, I strongly recommend using Rustyline or a similar library - please don't attempt to write your own.
@19wintersp, cool. I'll try to figure out a way to make rustyline work
This should be fixed by #27.