Returns a cursor offset and line with match swapped in
(
self, cursor_offset: int, line: str, match: str
)
| 263 | return word |
| 264 | |
| 265 | def substitute( |
| 266 | self, cursor_offset: int, line: str, match: str |
| 267 | ) -> tuple[int, str]: |
| 268 | """Returns a cursor offset and line with match swapped in""" |
| 269 | lpart = self.locate(cursor_offset, line) |
| 270 | assert lpart |
| 271 | offset = lpart.start + len(match) |
| 272 | changed_line = line[: lpart.start] + match + line[lpart.stop :] |
| 273 | return offset, changed_line |
| 274 | |
| 275 | @property |
| 276 | def shown_before_tab(self) -> bool: |