MCPcopy Index your code
hub / github.com/endbasic/endbasic / run

Method run

std/src/console/readline.rs:405–431  ·  view source on GitHub ↗

Runs the interactive key-processing loop until the line is accepted.

(mut self)

Source from the content-addressed store, hash-verified

403
404 /// Runs the interactive key-processing loop until the line is accepted.
405 async fn run(mut self) -> io::Result<String> {
406 loop {
407 let result = match self.console.read_key().await? {
408 Key::ArrowDown => self.do_up_down(1),
409 Key::ArrowLeft => self.do_move_to(self.pos.saturating_sub(1)),
410 Key::ArrowRight => self.do_move_to((self.pos + 1).min(self.line.len())),
411 Key::ArrowUp => self.do_up_down(-1),
412 Key::Backspace => self.do_backspace(),
413 Key::CarriageReturn => self.do_carriage_return(),
414 Key::Char(ch) => self.do_char(ch),
415 Key::Delete => self.do_delete(),
416 Key::End => self.do_end(),
417 Key::EofOrDelete => self.do_eof_or_delete(),
418 Key::Escape => self.do_ignore(),
419 Key::Home => self.do_home(),
420 Key::Interrupt => self.do_interrupt(),
421 Key::NewLine => self.do_newline(),
422 Key::PageDown | Key::PageUp | Key::Tab | Key::Unknown => self.do_ignore(),
423 }?;
424
425 if let DispatchResult::Submit = result {
426 break;
427 }
428 }
429
430 Ok(self.finish())
431 }
432}
433
434/// Reads a line of text interactively from the console, using the given `prompt` and pre-filling

Callers 1

read_line_interactiveFunction · 0.45

Calls 15

do_up_downMethod · 0.80
do_move_toMethod · 0.80
do_backspaceMethod · 0.80
do_carriage_returnMethod · 0.80
do_charMethod · 0.80
do_deleteMethod · 0.80
do_eof_or_deleteMethod · 0.80
do_ignoreMethod · 0.80
do_homeMethod · 0.80
do_interruptMethod · 0.80
do_newlineMethod · 0.80
read_keyMethod · 0.45

Tested by

no test coverage detected