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

Method print

std/src/console/pager.rs:83–106  ·  view source on GitHub ↗

Writes `text` to the console, followed by a newline or CRLF pair depending on the needs of the console to advance a line. The input `text` is not supposed to contain any control characters, such as CR or LF.

(&mut self, text: &str)

Source from the content-addressed store, hash-verified

81 ///
82 /// The input `text` is not supposed to contain any control characters, such as CR or LF.
83 pub(crate) async fn print(&mut self, text: &str) -> io::Result<()> {
84 self.console.print(text)?;
85 if self.console.is_interactive() {
86 if let Some(yielder) = self.yielder.as_ref() {
87 let mut yielder = yielder.borrow_mut();
88 yielder.yield_now().await;
89 }
90
91 self.cur_columns += text.len();
92 self.cur_lines += (self.cur_columns / usize::from(self.size.x)) + 1;
93
94 if self.cur_lines >= usize::from(self.size.y) - 1 {
95 self.console.print(self.more_message)?;
96 if matches!(self.console.read_key().await?, Key::Escape | Key::Interrupt) {
97 return Err(io::Error::new(io::ErrorKind::Interrupted, "Interrupted"));
98 }
99
100 self.cur_lines = 0;
101 }
102
103 self.cur_columns = 0;
104 }
105 Ok(())
106 }
107
108 /// Writes the text into the console at the position of the cursor.
109 ///

Callers 15

do_loginMethod · 0.45
async_execMethod · 0.45
show_aclsMethod · 0.45
read_boolMethod · 0.45
read_passwordMethod · 0.45
continue_if_modifiedFunction · 0.45
async_execMethod · 0.45
describeMethod · 0.45
summaryMethod · 0.45
execMethod · 0.45
refill_and_printFunction · 0.45
refill_and_pageFunction · 0.45

Calls 3

is_interactiveMethod · 0.45
yield_nowMethod · 0.45
lenMethod · 0.45