Show filename in text file preview

This commit is contained in:
Kovid Goyal
2025-11-22 12:39:29 +05:30
parent 4d4b287a4a
commit 9c3c6260c2

View File

@@ -222,7 +222,7 @@ func (p *TextFilePreview) Render(h *Handler, x, y, width, height int) {
s := utils.NewLineScanner(text)
buf := strings.Builder{}
buf.Grow(1024 * height)
for num := 0; s.Scan() && num < height; num++ {
for num := 1 + h.render_wrapped_text_in_region(filepath.Base(p.path), x, y, width, height, true); s.Scan() && num < height; num++ {
line := s.Text()
truncated := wcswidth.TruncateToVisualLength(line, width)
buf.WriteString(fmt.Sprintf(loop.MoveCursorToTemplate, y+num, x))