ratatui_toolkit/widgets/code_diff/foundation/enums/
diff_line_kind.rs

1//! Diff line kind enumeration.
2//!
3//! Represents the type of a line in a diff output.
4
5/// Represents the type of a line in a diff.
6///
7/// Each line in a diff can be one of several types:
8/// - Context lines that are unchanged
9/// - Added lines that exist only in the new version
10/// - Removed lines that exist only in the old version
11/// - Hunk headers that mark the start of a diff hunk
12///
13/// # Example
14///
15/// ```rust
16/// use ratatui_toolkit::code_diff::DiffLineKind;
17///
18/// let kind = DiffLineKind::Added;
19/// assert!(matches!(kind, DiffLineKind::Added));
20/// ```
21#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
22pub enum DiffLineKind {
23    /// An unchanged context line present in both old and new versions.
24    #[default]
25    Context,
26
27    /// A line that was added in the new version.
28    /// Typically displayed with a green background and '+' prefix.
29    Added,
30
31    /// A line that was removed from the old version.
32    /// Typically displayed with a red background and '-' prefix.
33    Removed,
34
35    /// A hunk header line (e.g., `@@ -1,4 +1,5 @@ context`).
36    /// Marks the start of a diff section with line number information.
37    HunkHeader,
38}