diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2015-08-28 21:23:10 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-08-28 21:23:10 +0900 |
| commit | 90b0cd44ac8fb9a6965c3dcf050f0e6aa2e90121 (patch) | |
| tree | 2d1f49202779dfbcf797e3b7290f077f1b19bfe5 /src/item.go | |
| parent | 698e8008df42d863af01a8da81f560f295f728ea (diff) | |
| download | fzf-90b0cd44ac8fb9a6965c3dcf050f0e6aa2e90121.tar.gz | |
Should not strip ANSI codes when --ansi is not set
Diffstat (limited to 'src/item.go')
| -rw-r--r-- | src/item.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/item.go b/src/item.go index 2ab8a78c..12ca3dfb 100644 --- a/src/item.go +++ b/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 |
