User input
When using erlang.get_line() and you press backspace it deletes the last word not the last character. Here is my code:
import gleam/io
import gleam/string
import gleam/erlang
pub fn main() {
case erlang.get_line("What is you name? ") {
Ok(name) -> io.println("Hello, " <> string.trim(name) <> "!")
Error(_) -> io.println("Something went wrong")
}
}
And here is a screen recording: https://github.com/user-attachments/assets/b2f273e7-fa27-49a3-8c04-e7881583d519
This library does not implement that function, it is part of Erlang, so we may not be able to help. The Erlang forums may be the place to ask. https://erlangforums.com/
Does it happen if you call it from the Erlang shell or an Erlang program?
Sorry that I didn't see your comment till now. It does not happen when calling from erlang or the erlang shell.
Another thing I forgot to mention, it only happens on windows, so it might have something to do with CRLF.
Does it only happen when using get_line? Does it happen when using gleam export erlang-shipment?
Does it only happen when using
get_line?
I have only tried get_line. Is there an alternative?
Does it happen when using
gleam export erlang-shipment?
I just tried that, and it still happens.
Could you try in Erlang after running these please
io:setopts(standard_io, [binary, {encoding, utf8}]),
io:setopts(standard_error, [{encoding, utf8}]).
I have just tried that, and it still works in erlang.
I'm confused as I can't think of anything that differs between the working erl scenario and the not working shipment scenario.
I think it has something to do with windows because it only happens there.