mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-26 14:56:30 +00:00
Strip ^N and ^O from preview output
https://github.com/junegunn/fzf/issues/391#issuecomment-257090266 e.g. fzf --preview 'printf "$(tput setaf 2)foo$(tput sgr0)bar\nbar\n"'
This commit is contained in:
parent
9f321cbe13
commit
02c6ad0e59
@ -682,7 +682,13 @@ func (w *Window) Erase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) Fill(str string) bool {
|
func (w *Window) Fill(str string) bool {
|
||||||
return C.waddstr(w.win, C.CString(str)) == C.OK
|
return C.waddstr(w.win, C.CString(strings.Map(func(r rune) rune {
|
||||||
|
// Remove ^N and ^O (set and unset altcharset)
|
||||||
|
if r == 14 || r == 15 {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
return r
|
||||||
|
}, str))) == C.OK
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) CFill(str string, fg int, bg int, a Attr) bool {
|
func (w *Window) CFill(str string, fg int, bg int, a Attr) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user