mirror of
https://github.com/junegunn/fzf.git
synced 2026-10-30 10:05:58 +00:00
Fix --preview-window follow not working correctly with wrapping
Fix #3243 Fix #4258
This commit is contained in:
6 files changed
+98
-8
No files matched your search
+4
-3
@@ -1377,7 +1377,8 @@ func WrapLine(input string, prefixLength int, initialMax int, tabstop int, wrapS
|
||||
width := 0
|
||||
line := ""
|
||||
gr := uniseg.NewGraphemes(input)
|
||||
max := initialMax
|
||||
maxWidth := initialMax
|
||||
contMax := max(1, initialMax-wrapSignWidth)
|
||||
for gr.Next() {
|
||||
rs := gr.Runes()
|
||||
str := string(rs)
|
||||
@@ -1392,14 +1393,14 @@ func WrapLine(input string, prefixLength int, initialMax int, tabstop int, wrapS
|
||||
}
|
||||
width += w
|
||||
|
||||
if prefixLength+width <= max {
|
||||
if prefixLength+width <= maxWidth {
|
||||
line += str
|
||||
} else {
|
||||
lines = append(lines, WrappedLine{string(line), width - w})
|
||||
line = str
|
||||
prefixLength = 0
|
||||
width = w
|
||||
max = initialMax - wrapSignWidth
|
||||
maxWidth = contMax
|
||||
}
|
||||
}
|
||||
lines = append(lines, WrappedLine{string(line), width})
|
||||
|
||||
Reference in new issue
Block a user