summaryrefslogtreecommitdiff
path: root/src/handlers/diff_header_diff.rs
diff options
context:
space:
mode:
authorThomas Otto <th1000s@posteo.net>2025-08-01 11:02:55 +0200
committerThomas Otto <th1000s@posteo.net>2025-08-01 11:09:18 +0200
commit59a907117bb9aeb467b392c4fdc36f2f931330c0 (patch)
treec1cf0c644732f5b2d516de27246d6d7d8d9cf9e8 /src/handlers/diff_header_diff.rs
parentcd4a9f4e74d243d44bdaebde5d4188cdc100951a (diff)
Fix diff output when a diff ends with a mode change
Output can be generated directly via Painter::write, or Painter::output_buffer. The latter must be emit()'ed before the former method can be used again, otherwise the order is incorrect. Tests added. Fixes #1504
Diffstat (limited to 'src/handlers/diff_header_diff.rs')
-rw-r--r--src/handlers/diff_header_diff.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/handlers/diff_header_diff.rs b/src/handlers/diff_header_diff.rs
index e88f89d..70aca72 100644
--- a/src/handlers/diff_header_diff.rs
+++ b/src/handlers/diff_header_diff.rs
@@ -13,6 +13,7 @@ impl StateMachine<'_> {
return Ok(false);
}
self.painter.paint_buffered_minus_and_plus_lines();
+ self.painter.emit()?;
self.state =
if self.line.starts_with("diff --cc ") || self.line.starts_with("diff --combined ") {
// We will determine the number of parents when we see the hunk header.