-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
read_line
displays the prompt message multiple times for strings ending with \n
.
#20563
Comments
It repeats the prompt for every character you type, as you type them. |
Yes! And it's strange because without the |
Not so strange, depending on how it was written. A "common" way to do it would be to move the cursor to the start of the line, and re-print the prompt + the char you typed. But if the prompt has |
Sure! In my case, I hadn't seen it happen before! That's why I found it strange! So can we consider that there is no bug in the implementation? Who would be able to say? Because I really don't know if this is the intended behavior of the implementation, and since I've never seen this case happen, I opened this issue to report it! |
It's definitely a bug. Just need someone to dig into the code and fix it. |
I found where the issue is occurring! However, I haven't found the solution yet. Once I find it, I'll submit a pull request The error occurs precisely because in the file, for example, readline_nix.c.v, the function for {
flush_stdout()
c := r.read_char() or { return err }
a := r.analyse(c)
if r.execute(a, c) {
break
}
} This And this As a result, every time the user enters a character, the To solve this, one could remove this |
Right. Check both with & without |
Describe the bug
When I run the code with v from within a file, after executing the code, the message appears on the screen and waits for input. When I enter the input, the message reappears with each character I input.
I conducted several tests and concluded that this happens when a
\n
is inserted at the end of the message, as shown in the code:With bug
No bug
Reproduction Steps
Expected Behavior
Current Behavior
Possible Solution
No response
Additional Information/Context
No response
V version
V full version: V 0.4.4 ed754cf.9560d53
Environment details (OS name and version, etc.)
OS: linux, Ubuntu 23.04
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: