mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 11:29:01 +00:00
Avoid rendering delay when displaying extremely long lines
Related #666
This commit is contained in:
parent
a749e6bd16
commit
00f96aae76
@ -401,6 +401,8 @@ func displayWidth(runes []rune) int {
|
|||||||
const (
|
const (
|
||||||
minWidth = 16
|
minWidth = 16
|
||||||
minHeight = 4
|
minHeight = 4
|
||||||
|
|
||||||
|
maxDisplayWidthCalc = 1024
|
||||||
)
|
)
|
||||||
|
|
||||||
func calculateSize(base int, size sizeSpec, margin int, minSize int) int {
|
func calculateSize(base int, size sizeSpec, margin int, minSize int) int {
|
||||||
@ -651,6 +653,11 @@ func displayWidthWithLimit(runes []rune, prefixWidth int, limit int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func trimLeft(runes []rune, width int) ([]rune, int32) {
|
func trimLeft(runes []rune, width int) ([]rune, int32) {
|
||||||
|
if len(runes) > maxDisplayWidthCalc && len(runes) > width {
|
||||||
|
trimmed := len(runes) - width
|
||||||
|
return runes[trimmed:], int32(trimmed)
|
||||||
|
}
|
||||||
|
|
||||||
currentWidth := displayWidth(runes)
|
currentWidth := displayWidth(runes)
|
||||||
var trimmed int32
|
var trimmed int32
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user