mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 00:03:39 -05:00
Should not strip ANSI codes when --ansi is not set
This commit is contained in:
14
src/item.go
14
src/item.go
@@ -94,15 +94,19 @@ func (item *Item) Rank(cache bool) Rank {
|
||||
}
|
||||
|
||||
// AsString returns the original string
|
||||
func (item *Item) AsString() string {
|
||||
return *item.StringPtr()
|
||||
func (item *Item) AsString(stripAnsi bool) string {
|
||||
return *item.StringPtr(stripAnsi)
|
||||
}
|
||||
|
||||
// StringPtr returns the pointer to the original string
|
||||
func (item *Item) StringPtr() *string {
|
||||
func (item *Item) StringPtr(stripAnsi bool) *string {
|
||||
if item.origText != nil {
|
||||
trimmed, _, _ := extractColor(string(*item.origText), nil)
|
||||
return &trimmed
|
||||
if stripAnsi {
|
||||
trimmed, _, _ := extractColor(string(*item.origText), nil)
|
||||
return &trimmed
|
||||
}
|
||||
orig := string(*item.origText)
|
||||
return &orig
|
||||
}
|
||||
str := string(item.text)
|
||||
return &str
|
||||
|
||||
Reference in New Issue
Block a user