From 4f5698a5a232053461ec581551523a93fe0ba9c6 Mon Sep 17 00:00:00 2001 From: Petar Dobrev Date: Sun, 19 Apr 2026 09:24:44 +0300 Subject: [PATCH] fix overlap with the next file's header --- docs/changelog.rst | 3 +++ kittens/diff/ui.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 57595dd70..517b7412e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -251,6 +251,9 @@ Detailed list of changes - macOS: Fix occasional phantom cursors being drawn on screen (:iss:`9725`) +- diff kitten: A new option :opt:`sticky_header` to pin the current file's name to the top of the screen as you scroll through a multi-file diff (:pull:`9891`) + + 0.46.2 [2026-03-21] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kittens/diff/ui.go b/kittens/diff/ui.go index 0957f29e4..ef87ae37a 100644 --- a/kittens/diff/ui.go +++ b/kittens/diff/ui.go @@ -452,6 +452,12 @@ func (self *Handler) draw_sticky_header(pos *ScrollPos) int { if title_idx < 0 { return 0 } + // If the next line is a different file's TITLE_LINE, skip sticky so the + // real title flows into view naturally instead of being consumed. + next := pos.logical_line + 1 + if next < self.logical_lines.Len() && self.logical_lines.At(next).line_type == TITLE_LINE && next != title_idx { + return 0 + } // file title self.logical_lines.At(title_idx).render_screen_line(0, self.lp, self.logical_lines.margin_size, self.logical_lines.columns) self.lp.MoveCursorVertically(1)