MCPcopy Create free account
hub / github.com/TheRedDeveloper/ply-engine / click_to_cursor_styled

Method click_to_cursor_styled

src/text_input.rs:1068–1083  ·  view source on GitHub ↗

Click to cursor in styled mode. `click_visual_pos` is the visual character position determined from click x.

(&mut self, click_visual_pos: usize, shift: bool)

Source from the content-addressed store, hash-verified

1066 /// Click to cursor in styled mode.
1067 /// `click_visual_pos` is the visual character position determined from click x.
1068 pub fn click_to_cursor_styled(&mut self, click_visual_pos: usize, shift: bool) {
1069 if shift {
1070 if self.selection_anchor.is_none() {
1071 self.selection_anchor = Some(self.cursor_pos);
1072 }
1073 } else {
1074 self.selection_anchor = None;
1075 }
1076 self.cursor_pos = click_visual_pos;
1077 if shift {
1078 if self.selection_anchor == Some(self.cursor_pos) {
1079 self.selection_anchor = None;
1080 }
1081 }
1082 self.cleanup_after_move();
1083 }
1084
1085 /// Select word at visual position in styled mode.
1086 pub fn select_word_at_styled(&mut self, visual_pos: usize) {

Callers 2

Calls 1

cleanup_after_moveMethod · 0.80

Tested by

no test coverage detected