*/
// To use it as a super-history-search for bash:
-// selector -q -b -i -d -v -w -l 10000 <(history)
+// selector -q -b -i -d -v -w -l ${HISTSIZE} <(history)
#include <fstream>
#include <iostream>
char *title = 0;
int error_flash = 0;
-#define COLOR_MODELINE 1
-#define COLOR_FOCUS_LINE 2
-#define COLOR_ERROR 3
-
int attr_modeline, attr_focus_line, attr_error;
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// A quick and dirty hash table
-// The table itself stores index of the strings in a char
+// The table itself stores indexes of the strings taken in a char
// **table. When a string is added, if it was already in the table,
// the new index replaces the previous one.
// the previous index it had.
int test_and_add(char *new_string, int new_index,
- char **strings, int *hash_table, int hash_table_size) {
+ char **strings,
+ int *hash_table, int hash_table_size) {
unsigned int code = 0;
//////////////////////////////////////////////////////////////////////
// The value passed to this routine in current_focus_line is the index
-// of the line to highlighted if it matches the matcher. The line
-// highlighted is the first the one matching the matcher in that
-// order: The current_focus_line itself, the first with a greated
-// index, the first with a lesser index.
+// of the line to highlight if it matches the matcher. The line
+// highlighted is the first one matching the matcher in that order:
+// (1) current_focus_line after motion, (2) the first with a greater
+// index, (3) the first with a lesser index.
// The index of the line actually shown highlighted is written in
// displayed_focus_line (it can be -1)
int nb_printed_lines = 0;
use_default_colors();
+
addstr("\n");
if(matcher.regexp_error) {
exit(1);
}
- init_pair(COLOR_MODELINE, color_fg_modeline, color_bg_modeline);
- init_pair(COLOR_FOCUS_LINE, color_fg_highlight, color_bg_highlight);
- init_pair(COLOR_ERROR, COLOR_WHITE, COLOR_RED);
+ init_pair(1, color_fg_modeline, color_bg_modeline);
+ attr_modeline = COLOR_PAIR(1);
- attr_modeline = COLOR_PAIR(COLOR_MODELINE);
- attr_focus_line = COLOR_PAIR(COLOR_FOCUS_LINE);
- attr_error = COLOR_PAIR(COLOR_ERROR);
+ init_pair(2, color_fg_highlight, color_bg_highlight);
+ attr_focus_line = COLOR_PAIR(2);
+
+ init_pair(3, COLOR_WHITE, COLOR_RED);
+ attr_error = COLOR_PAIR(3);
}
}
out.flush();
}
+
} else {
cout << "Aborted." << endl;
}