Return True when running diff(old, new) would be both slow and structurally suspect — meaning the buffer has diverged from the snippet's tracked state in a way no reasonable replay can recover. Heuristic: the character-count delta exceeds what an interactive snippet edit could plaus
(old_lines, new_lines)
| 37 | |
| 38 | |
| 39 | def _is_pathological_diff_input(old_lines, new_lines): |
| 40 | """Return True when running diff(old, new) would be both slow and |
| 41 | structurally suspect — meaning the buffer has diverged from the |
| 42 | snippet's tracked state in a way no reasonable replay can recover. |
| 43 | |
| 44 | Heuristic: the character-count delta exceeds what an interactive |
| 45 | snippet edit could plausibly produce in a single CursorMoved cycle. |
| 46 | """ |
| 47 | return ( |
| 48 | abs(_joined_len(new_lines) - _joined_len(old_lines)) > _PATHOLOGICAL_CHAR_DELTA |
| 49 | ) |
| 50 | |
| 51 | |
| 52 | def diff(a, b, sline=0): |