MCPcopy Create free account
hub / github.com/GCWing/BitFun / handle_backspace

Method handle_backspace

src/apps/cli/src/ui/text_input.rs:85–93  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

83 }
84
85 pub fn handle_backspace(&mut self) {
86 if self.cursor > 0 && !self.input.is_empty() {
87 let byte_pos = self.char_pos_to_byte_pos(self.cursor - 1);
88 if byte_pos < self.input.len() {
89 self.input.remove(byte_pos);
90 self.cursor -= 1;
91 }
92 }
93 }
94
95 pub fn handle_delete(&mut self) {
96 let char_count = self.input.chars().count();

Callers 2

handle_keyMethod · 0.45
handle_key_eventMethod · 0.45

Calls 4

char_pos_to_byte_posMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected