Allowing displaying a prompt during incomplete validation#552
Allowing displaying a prompt during incomplete validation#552ejose19 wants to merge 1 commit intokkawakam:masterfrom
Conversation
0bef68d to
865d7f8
Compare
865d7f8 to
eb4d7f7
Compare
|
I see that: Lines 145 to 147 in 250c9e6 occurs after the layout change, so even if newline was inserted when there is a message, it won't be seen. Should this be refactored instead to be an option? (ie: |
ValidationResult::Incomplete
You mean a custom hint ? |
Yep currently you can't have both. |
I don't think this would clasify as a hint, since it will appear to the left of user input, and shouldn't disappear once user start typing nor when he enter more lines, ie ( |
|
Yes, I've tried with that, but there's 2 issues:
I used this to simplify testing: ValidationResult::Incomplete(ref msg) => {
if msg.is_some() {
self.edit_insert('\n', 1)?;
self.refresh_line_with_msg(msg.as_deref())?;
}
}EDIT: After evaluating this more thoroughly, this may not fit here since rustyline allows to go back to previous lines, and that would let users "complete" a previously incomplete line, which would render the "incomplete msg" in the next line useless. |
|
@gwenn The only limitation I see is that both prompts must have the same width, which wouldn't apply for |
This change will let consumers write a custom prompt on incomplete validation result, one of the use cases is allowing REPL to display an indicator that it's expecting more input before evaluating (like
nodemulti line displaying...as pseudo-prompt).Semver major due the breaking change.