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

Method handle_char

src/apps/cli/src/ui/text_input.rs:66–77  ·  view source on GitHub ↗
(&mut self, c: char)

Source from the content-addressed store, hash-verified

64 }
65
66 pub fn handle_char(&mut self, c: char) {
67 if c == '\n' {
68 self.handle_newline();
69 return;
70 }
71 if c.is_control() || c == '\u{0}' {
72 return;
73 }
74 let byte_pos = self.char_pos_to_byte_pos(self.cursor);
75 self.input.insert(byte_pos, c);
76 self.cursor += 1;
77 }
78
79 pub fn handle_newline(&mut self) {
80 let byte_pos = self.char_pos_to_byte_pos(self.cursor);

Callers 5

insert_pasteMethod · 0.45
handle_keyMethod · 0.45
runMethod · 0.45
handle_key_eventMethod · 0.45
handle_non_key_eventMethod · 0.45

Calls 3

char_pos_to_byte_posMethod · 0.80
handle_newlineMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected