MCPcopy Create free account
hub / github.com/IntegralPilot/wasm_os / write_string

Method write_string

src/vga_buffer.rs:113–122  ·  view source on GitHub ↗

Writes the given ASCII string to the buffer. Wraps lines at `BUFFER_WIDTH`. Supports the `\n` newline character. Does **not support strings with non-ASCII characters, since they can't be printed in the VGA text mode.

(&mut self, s: &str)

Source from the content-addressed store, hash-verified

111 /// support strings with non-ASCII characters, since they can't be printed in the VGA text
112 /// mode.
113 fn write_string(&mut self, s: &str) {
114 for byte in s.bytes() {
115 match byte {
116 // printable ASCII byte or newline
117 0x20..=0x7e | b'\n' => self.write_byte(byte),
118 // not part of printable ASCII range
119 _ => self.write_byte(0xfe),
120 }
121 }
122 }
123
124 /// Shifts all lines one line up and clears the last row.
125 fn new_line(&mut self) {

Callers 5

println_with_colorMethod · 0.80
print_with_colorMethod · 0.80
write_strMethod · 0.80
_print_with_both_colorsFunction · 0.80

Calls 1

write_byteMethod · 0.80

Tested by

no test coverage detected