Fix regression where lines are skipped in the preview window

Fix #2239
This commit is contained in:
Junegunn Choi 2020-11-03 21:31:19 +09:00
parent 15d351b0f0
commit 1bcbc5a353
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
2 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,10 @@
CHANGELOG CHANGELOG
========= =========
0.24.2
------
- Bug fixes and improvements
0.24.1 0.24.1
------ ------
- Fixed broken `--color=[bw|no]` option - Fixed broken `--color=[bw|no]` option

View File

@ -1254,6 +1254,7 @@ func (t *Terminal) renderPreviewText(unchanged bool) {
} }
var ansi *ansiState var ansi *ansiState
for _, line := range t.previewer.lines { for _, line := range t.previewer.lines {
line = strings.TrimSuffix(line, "\n")
if lineNo >= height || t.pwindow.Y() == height-1 && t.pwindow.X() > 0 { if lineNo >= height || t.pwindow.Y() == height-1 && t.pwindow.X() > 0 {
t.previewed.filled = true t.previewed.filled = true
break break
@ -1284,6 +1285,7 @@ func (t *Terminal) renderPreviewText(unchanged bool) {
if unchanged && lineNo == 0 { if unchanged && lineNo == 0 {
break break
} }
t.pwindow.Fill("\n")
} }
lineNo++ lineNo++
} }