Skip to content
Myr

Avoid rendering delay when displaying extremely long lines

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Related #666

authored by Junegunn Choi · committed by Junegunn Choi · parent a749e6b · Browse files · 1 file+7 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−0 removed

  • other:+7 added−0 removed

1 file+7 added−0 removed

modified:src/terminal.go+7 added
399 unmodified lines
400401const (402 minWidth = 16403 minHeight = 4404405 maxDisplayWidthCalc = 1024406)407408func calculateSize(base int, size sizeSpec, margin int, minSize int) int {409 max := base - margin
242 unmodified lines
652 return l653}654655func trimLeft(runes []rune, width int) ([]rune, int32) {656 if len(runes) > maxDisplayWidthCalc && len(runes) > width {657 trimmed := len(runes) - width658 return runes[trimmed:], int32(trimmed)659 }660661 currentWidth := displayWidth(runes)662 var trimmed int32663664 for currentWidth > width && len(runes) > 0 {
761 unmodified lines