@@ -73,26 +73,30 @@ impl<'b> Controller<'b> {
7373 }
7474 Ok(mut opened_input) => {
7575 #[cfg(feature = "git")]
76− let line_changes = if self.config.visible_lines.diff_context()
76+ let line_changes = if self.config.visible_lines.diff_mode()
7777 || (!self.config.loop_through && self.config.style_components.changes())
7878 {
79− if let crate::input::OpenedInputKind::OrdinaryFile(ref path) =
80− opened_input.kind
81− {
82− let diff = get_git_diff(path);
83−
84− if self.config.visible_lines.diff_context()
85− && diff
86− .as_ref()
87− .map(|changes| changes.is_empty())
88− .unwrap_or(false)
89− {
79+ match opened_input.kind {
80+ crate::input::OpenedInputKind::OrdinaryFile(ref path) => {
81+ let diff = get_git_diff(path);
82+
83+ // Skip files without Git modifications
84+ if self.config.visible_lines.diff_mode()
85+ && diff
86+ .as_ref()
87+ .map(|changes| changes.is_empty())
88+ .unwrap_or(false)
89+ {
90+ continue;
91+ }
92+
93+ diff
94+ }
95+ _ if self.config.visible_lines.diff_mode() => {
96+ // Skip non-file inputs in diff mode
9097 continue;
9198 }
92−
93− diff
94− } else {
95− None
99+ _ => None,
96100 }
97101 } else {
98102 None
@@ -134,7 +138,7 @@ impl<'b> Controller<'b> {
134138 printer: &mut dyn Printer,
135139 writer: &mut dyn Write,
136140 input: &mut OpenedInput,
137− #[cfg(feature = "git")] line_changes: &Option<LineChanges>,
141+ line_changes: &Option<LineChanges>,
138142 ) -> Result<()> {
139143 if !input.reader.first_line.is_empty() || self.config.style_components.header() {
140144 printer.print_header(writer, input)?;