Skip to main content

Module line_diff

Module line_diff 

Source
Expand description

Line-based diff algorithm for comparing saved vs current buffer content.

This module provides a simple but robust diff algorithm that correctly handles insertions, deletions, and modifications. It uses a longest common subsequence (LCS) approach to identify which lines are unchanged, then marks the ranges that differ.

Structs§

LineChange
A range of lines with a specific change type
LineDiff
Result of comparing two text buffers line by line.

Enums§

ChangeType
Type of change detected for a line range

Functions§

diff_lines
Compare two byte slices line by line and return which lines in current differ from saved.
merge_ranges
Merge adjacent or overlapping ranges.