fix overlap with the next file's header

This commit is contained in:
Petar Dobrev 2026-04-19 09:24:44 +03:00
parent 7729e6e1ae
commit 4f5698a5a2
2 changed files with 9 additions and 0 deletions

View file

@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -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)