mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-07 23:52:04 -07:00
@@ -656,8 +656,6 @@ func (t *Terminal) displayWidth(runes []rune) int {
|
|||||||
const (
|
const (
|
||||||
minWidth = 4
|
minWidth = 4
|
||||||
minHeight = 4
|
minHeight = 4
|
||||||
|
|
||||||
maxDisplayWidthCalc = 1024
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func calculateSize(base int, size sizeSpec, occupied int, minSize int, pad int) int {
|
func calculateSize(base int, size sizeSpec, occupied int, minSize int, pad int) int {
|
||||||
@@ -1116,13 +1114,15 @@ func (t *Terminal) displayWidthWithLimit(runes []rune, prefixWidth int, limit in
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Terminal) trimLeft(runes []rune, width int) ([]rune, int32) {
|
func (t *Terminal) trimLeft(runes []rune, width int) ([]rune, int32) {
|
||||||
if len(runes) > maxDisplayWidthCalc && len(runes) > width {
|
var trimmed int32
|
||||||
trimmed := len(runes) - width
|
// Assume that each rune takes at least one column on screen
|
||||||
return runes[trimmed:], int32(trimmed)
|
if len(runes) > width {
|
||||||
|
diff := len(runes) - width
|
||||||
|
trimmed = int32(diff)
|
||||||
|
runes = runes[diff:]
|
||||||
}
|
}
|
||||||
|
|
||||||
currentWidth := t.displayWidth(runes)
|
currentWidth := t.displayWidth(runes)
|
||||||
var trimmed int32
|
|
||||||
|
|
||||||
for currentWidth > width && len(runes) > 0 {
|
for currentWidth > width && len(runes) > 0 {
|
||||||
runes = runes[1:]
|
runes = runes[1:]
|
||||||
|
Reference in New Issue
Block a user