Skip to content
Snippets Groups Projects
Unverified Commit 00f96aae authored by Junegunn Choi's avatar Junegunn Choi
Browse files

Avoid rendering delay when displaying extremely long lines

Related #666
parent a749e6bd
No related branches found
No related tags found
No related merge requests found
...@@ -401,6 +401,8 @@ func displayWidth(runes []rune) int { ...@@ -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 { ...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment