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

Method do_delete

std/src/console/readline.rs:215–232  ·  view source on GitHub ↗

Handles deletion of the character under the cursor.

(&mut self)

Source from the content-addressed store, hash-verified

213
214 /// Handles deletion of the character under the cursor.
215 fn do_delete(&mut self) -> io::Result<DispatchResult> {
216 if self.pos >= self.line.len() {
217 return Ok(DispatchResult::Continue);
218 }
219
220 if self.view_start == 0 && self.line.len() <= self.input_width {
221 self.erase_at(self.pos, self.pos)?;
222 self.sync_rendered();
223 } else {
224 let old_pos = self.current_pos();
225 let clear_len = self.rendered_len;
226 self.line.remove(self.pos);
227 self.view_start = self.adjust_view(self.pos, self.view_start);
228 self.sync_rendered();
229 self.redraw_line(old_pos, clear_len, self.current_pos())?;
230 }
231 Ok(DispatchResult::Continue)
232 }
233
234 /// Moves the cursor to the end of the line.
235 fn do_end(&mut self) -> io::Result<DispatchResult> {

Callers 2

do_eof_or_deleteMethod · 0.80
runMethod · 0.80

Calls 7

erase_atMethod · 0.80
sync_renderedMethod · 0.80
current_posMethod · 0.80
removeMethod · 0.80
adjust_viewMethod · 0.80
redraw_lineMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected