MCPcopy Create free account
hub / github.com/Eeive/Evcode-ide / insert_line

Method insert_line

src/editor/document.rs:162–170  ·  view source on GitHub ↗
(&mut self, line: usize, text: &str)

Source from the content-addressed store, hash-verified

160 }
161
162 pub fn insert_line(&mut self, line: usize, text: &str) {
163 let char_idx = if line >= self.line_count() {
164 self.len_chars()
165 } else {
166 self.line_to_char(line)
167 };
168 self.rope.insert(char_idx, text);
169 self.rope.insert_char(char_idx + text.chars().count(), '\n');
170 }
171
172 pub fn remove_char_range(&mut self, start: usize, end: usize) {
173 let start = start.min(self.len_chars());

Callers

nothing calls this directly

Calls 4

len_charsMethod · 0.80
line_to_charMethod · 0.80
line_countMethod · 0.45
insert_charMethod · 0.45

Tested by

no test coverage detected