Sha256: 2a86211aae3b54df982ae52bb8747bb7278b80bbe70eb1c287b2674a35451b6f

Contents?: true

Size: 957 Bytes

Versions: 87

Compression:

Stored size: 957 Bytes

Contents

package fzf

import (
	"github.com/junegunn/fzf/src/util"
)

// Item represents each input line. 56 bytes.
type Item struct {
	text        util.Chars    // 32 = 24 + 1 + 1 + 2 + 4
	transformed *[]Token      // 8
	origText    *[]byte       // 8
	colors      *[]ansiOffset // 8
}

// Index returns ordinal index of the Item
func (item *Item) Index() int32 {
	return item.text.Index
}

var minItem = Item{text: util.Chars{Index: -1}}

func (item *Item) TrimLength() uint16 {
	return item.text.TrimLength()
}

// Colors returns ansiOffsets of the Item
func (item *Item) Colors() []ansiOffset {
	if item.colors == nil {
		return []ansiOffset{}
	}
	return *item.colors
}

// AsString returns the original string
func (item *Item) AsString(stripAnsi bool) string {
	if item.origText != nil {
		if stripAnsi {
			trimmed, _, _ := extractColor(string(*item.origText), nil, nil)
			return trimmed
		}
		return string(*item.origText)
	}
	return item.text.ToString()
}

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
doing-2.1.88 lib/helpers/fzf/src/item.go
doing-2.1.87 lib/helpers/fzf/src/item.go
doing-2.1.86 lib/helpers/fzf/src/item.go
doing-2.1.85 lib/helpers/fzf/src/item.go
doing-2.1.84 lib/helpers/fzf/src/item.go
doing-2.1.83 lib/helpers/fzf/src/item.go
doing-2.1.82 lib/helpers/fzf/src/item.go
doing-2.1.81 lib/helpers/fzf/src/item.go
doing-2.1.80 lib/helpers/fzf/src/item.go
doing-2.1.79 lib/helpers/fzf/src/item.go
doing-2.1.78 lib/helpers/fzf/src/item.go
doing-2.1.77 lib/helpers/fzf/src/item.go
doing-2.1.76 lib/helpers/fzf/src/item.go
doing-2.1.75 lib/helpers/fzf/src/item.go
doing-2.1.74 lib/helpers/fzf/src/item.go
doing-2.1.73 lib/helpers/fzf/src/item.go
doing-2.1.72 lib/helpers/fzf/src/item.go
doing-2.1.69 lib/helpers/fzf/src/item.go
doing-2.1.68 lib/helpers/fzf/src/item.go
doing-2.1.66 lib/helpers/fzf/src/item.go