-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected ^O when using fzf --ansi #391
Comments
It works fine if using |
Thanks, I'll fix it. |
Hmm, it turned out that it's an issue of how ncurses prints non-printable characters. echo $'\x0f' | fzf
echo $'\x01' | fzf
# ... #include <stdio.h>
#include <unistd.h>
#include <curses.h>
int main() {
WINDOW * win = initscr();
char msg[100];
sprintf(msg, "Hello,%cworld!", (char) 0xf);
mvaddstr(0, 0, msg);
refresh();
sleep(2);
delwin(win);
endwin();
refresh();
} |
I'm not 100% sure if it's the correct approach, but simply ignoring non-printable characters fixes the issue. |
Great, Thanks ! |
This issue still happens if the command passed to the I investigated what was being printed and found this snippet in the manual page of terminfo:
Since
I have no idea why this particular escape sequence isn't handled properly, but maybe these findings can help you with dealing with this problem. |
@nevesnunes Thanks for the info. The ANSI procesor of fzf only handles sequences that start with |
#391 (comment) e.g. fzf --preview 'printf "$(tput setaf 2)foo$(tput sgr0)bar\nbar\n"'
printf "$(tput setaf 2)foo$(tput sgr0)bar\nbar\n"
echoes
foobar
bar
while
printf "$(tput setaf 2)foo$(tput sgr0)bar\nbar\n" | fzf --ansi
echoes
foo^Obar
bar
I've replaced what is placed in green by bold because that's the only way to format on github.
I have the latest fzf version, 0.10.8
The text was updated successfully, but these errors were encountered: