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

Method char_pos_to_byte_pos

src/apps/cli/src/ui/text_input.rs:301–307  ·  view source on GitHub ↗
(&self, char_pos: usize)

Source from the content-addressed store, hash-verified

299 }
300
301 pub fn char_pos_to_byte_pos(&self, char_pos: usize) -> usize {
302 self.input
303 .char_indices()
304 .nth(char_pos)
305 .map(|(pos, _)| pos)
306 .unwrap_or(self.input.len())
307 }
308
309 // ── Rendering ──
310

Callers 5

handle_charMethod · 0.80
handle_newlineMethod · 0.80
handle_backspaceMethod · 0.80
handle_deleteMethod · 0.80

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected