MCPcopy Create free account
hub / github.com/adam-mcdaniel/lite / insert

Method insert

src/buffer.rs:261–273  ·  view source on GitHub ↗
(&mut self, ch: char)

Source from the content-addressed store, hash-verified

259 }
260
261 pub fn insert(&mut self, ch: char) {
262 self.edited = true;
263 if ch == '\n' {
264 let col = self.cursor_col;
265 let line = self.cur_line_mut();
266 let last_half = line.split_off(col);
267 self.lines.insert(self.cursor_row + 1, last_half);
268 } else {
269 let col = self.cursor_col;
270 self.cur_line_mut().insert(col, ch);
271 }
272 self.move_cur(Direction::Right);
273 }
274
275 pub fn delete(&mut self) -> Option<char> {
276 self.edited = true;

Callers 10

mainFunction · 0.45
insert_strMethod · 0.45
applyMethod · 0.45
undoMethod · 0.45
process_exprFunction · 0.45
dictFunction · 0.45
setMethod · 0.45
aliasMethod · 0.45
insertFunction · 0.45
evalFunction · 0.45

Calls 2

cur_line_mutMethod · 0.80
move_curMethod · 0.45

Tested by

no test coverage detected