Skip to content
Snippets Groups Projects
Unverified Commit 02c6ad0e authored by Junegunn Choi's avatar Junegunn Choi
Browse files

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"'
parent 9f321cbe
No related branches found
No related tags found
No related merge requests found
......@@ -682,7 +682,13 @@ func (w *Window) Erase() {
}
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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment