I'm not sure what this looks like yet, but there's not currently a way to ask for simple user input in the way that Vim does when using features like the c flag for substitutions, or the :confirm command. Given that a lot of these happen in the middle of doing work, I wonder if it should be a UIError. Maybe something like:
pub trait Dialog<I>
where
I: ApplicationInfo,
{
/// Message to show to users, such as "Quit? (y/N)"
fn message(&self) -> String;
/// How many characters to read from the user before calling input().
fn input_max(&self) -> usize;
/// The user's response to this interactive dialog. The user will be repeatedly
/// prompted until this returns Some.
fn input(&mut self, s: &str) -> Option<Action<I>>;
}
pub enum UIError<I>
where
I: ApplicationInfo,
{
...
NeedConfirm(Box<dyn Dialog>),
}
I'm not sure what this looks like yet, but there's not currently a way to ask for simple user input in the way that Vim does when using features like the
c
flag for substitutions, or the:confirm
command. Given that a lot of these happen in the middle of doing work, I wonder if it should be aUIError
. Maybe something like: