From 5096c70784d53b70db47028d7ebc766f8c02f0bf Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 17 Mar 2009 21:03:25 +0100 Subject: [PATCH] Added conversion of control characters to standard strings with unctrl(). --- selector.cc | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/selector.cc b/selector.cc index 568da6e..31bf262 100644 --- a/selector.cc +++ b/selector.cc @@ -394,7 +394,7 @@ int main(int argc, char **argv) { exit(1); } - char buffer[buffer_size]; + char buffer[buffer_size], raw_line[buffer_size];; int color_fg_modeline, color_bg_modeline; int color_fg_highlight, color_bg_highlight; @@ -543,9 +543,23 @@ int main(int argc, char **argv) { } while(nb_lines < nb_lines_max && !file.eof()) { - file.getline(buffer, buffer_size); - if(strcmp(buffer, "") != 0) { - char *s = buffer; + + file.getline(raw_line, buffer_size); + + if(strcmp(raw_line, "") != 0) { + + char *s, *t; + const char *u; + + s = buffer; + t = raw_line; + while(*t) { + u = unctrl(*t++); + while(*u) { *s++ = *u++; } + } + *s = '\0'; + + s = buffer; if(zsh_history && *s == ':') { while(*s && *s != ';') s++; -- 2.39.5