Cleanup empty styles after a cursor movement. Called after any movement that doesn't modify text.
(&mut self)
| 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. |
no test coverage detected