MCPcopy Create free account
hub / github.com/Infinity-OS/infinity / new_line

Method new_line

src/vga_buffer.rs:107–130  ·  view source on GitHub ↗

Adds a new file

(&mut self)

Source from the content-addressed store, hash-verified

105
106 /// Adds a new file
107 fn new_line(&mut self) {
108 // increment the current row
109 self.row_positon += 1;
110
111 // reset the column positon
112 self.column_position = 0;
113
114 // scroll the view if there is no more free rows
115 if self.row_positon == BUFFER_HEIGHT {
116 for row in 1..BUFFER_HEIGHT {
117 for col in 0..BUFFER_WIDTH {
118 let buffer = self.buffer();
119 let character = buffer.chars[row][col].read();
120 buffer.chars[row - 1][col].write(character);
121 }
122 }
123
124 // clear the last row
125 self.clear_row(BUFFER_HEIGHT - 1);
126
127 // positon the cursor on the last row
128 self.row_positon -= 1;
129 }
130 }
131
132 /// Clear a full row
133 fn clear_row(&mut self, row: usize) {

Callers 1

write_byteMethod · 0.80

Calls 4

bufferMethod · 0.80
clear_rowMethod · 0.80
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected