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

Method cleanup_after_move

src/text_input.rs:1116–1127  ·  view source on GitHub ↗

Cleanup empty styles after a cursor movement. Called after any movement that doesn't modify text.

(&mut self)

Source from the content-addressed store, hash-verified

1114 /// Cleanup empty styles after a cursor movement.
1115 /// Called after any movement that doesn't modify text.
1116 fn cleanup_after_move(&mut self) {
1117 // Snap first so the cursor moves away from structural positions;
1118 // this lets cleanup_empty_styles remove tags the cursor isn't inside.
1119 self.snap_to_content_pos();
1120 let (cleaned, new_pos) = styling::cleanup_empty_styles(&self.text, self.cursor_pos);
1121 self.text = cleaned;
1122 self.cursor_pos = new_pos;
1123 // Re-snap after cleanup since the text may have changed.
1124 self.snap_to_content_pos();
1125 self.preferred_col = None;
1126 self.reset_blink();
1127 }
1128
1129 /// Convert the visual cursor_pos to a raw position for rendering.
1130 /// Enters empty style tags at the cursor boundary.

Callers 9

insert_text_styledMethod · 0.80
move_left_styledMethod · 0.80
move_left_contentMethod · 0.80
move_right_styledMethod · 0.80
move_word_left_styledMethod · 0.80
move_home_styledMethod · 0.80
move_end_styledMethod · 0.80

Calls 3

cleanup_empty_stylesFunction · 0.85
snap_to_content_posMethod · 0.80
reset_blinkMethod · 0.80

Tested by

no test coverage detected