int output_to_vt_buffer = 0;
int add_control_qs = 0;
int with_colors = 1;
-int zsh_history = 0, bash_history = 0;
+int zsh_history = 0;
+int bash_history = 0;
int inverse_order = 0;
int remove_duplicates = 0;
int use_regexp = 0;
#define COLOR_MODELINE 1
#define COLOR_HIGHLIGHTED_LINE 2
+#define COLOR_ERROR 3
//////////////////////////////////////////////////////////////////////
}
}
+void print_error_message(const char *message, int width) {
+ if(with_colors) {
+ attron(COLOR_PAIR(COLOR_ERROR));
+ addnstr(message, width);
+ attroff(COLOR_PAIR(COLOR_ERROR));
+ } else {
+ attron(A_STANDOUT);
+ addnstr(message, width);
+ attroff(A_STANDOUT);
+ }
+}
+
//////////////////////////////////////////////////////////////////////
// A quick and dirty hash table
addstr("\n");
if(matcher.regexp_error) {
- addstr("[regexp error]");
+ print_error_message("[regexp error]", console_width);
} else if(nb_lines > 0) {
int new_line;
if(match(lines[*current_line], &matcher)) {
*temporary_line = new_line;
if(nb_printed_lines == 0) {
- addnstr("[no selection]\n", console_width);
+ print_error_message("[no selection]\n", console_width);
}
} else {
- addnstr("[empty choice]\n", console_width);
+ print_error_message("[empty choice]\n", console_width);
}
clrtobot();
<< endl
<< " -h show this help" << endl
<< " -v inject the selected line in the tty" << endl
+ << " -w quote control characters with ^Qs when using -v" << endl
<< " -d remove duplicated lines" << endl
<< " -b remove the bash history line prefix" << endl
<< " -z remove the zsh history line prefix" << endl
<< " -a case sensitive" << endl
<< " -m monochrome mode" << endl
<< " -q make a flash instead of a beep on an edition error" << endl
- << " -- rest of the arguments are filenames" << endl
+ << " -- all following arguments are filenames" << endl
<< " -t <title>" << endl
<< " add a title in the modeline" << endl
<< " -c <fg modeline> <bg modeline> <fg highlight> <bg highlight>" << endl
init_pair(COLOR_MODELINE, color_fg_modeline, color_bg_modeline);
init_pair(COLOR_HIGHLIGHTED_LINE, color_fg_highlight, color_bg_highlight);
+ init_pair(COLOR_ERROR, COLOR_WHITE, COLOR_RED);
} else {
with_colors = 0;