From: Francois Fleuret Date: Thu, 12 Mar 2009 20:01:20 +0000 (+0100) Subject: Automatic commit X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=1777ff299211ccf4ff4c71113bb92bd65f0e997c;p=selector.git Automatic commit --- diff --git a/selector.1 b/selector.1 index 3b8a433..8963977 100644 --- a/selector.1 +++ b/selector.1 @@ -16,11 +16,25 @@ correct option, it will inject the selected line into the virtual tty input buffer, hence allowing the user to edit the line and execute it as a standard command. +Keys corresponding to ASCII codes between ' ' and '~' add a character +to the pattern string. The Delete key, Backspace key, ^D and ^H delete +one character from the pattern string. + +The up and down cursor keys move the selected line accordingly, and +the PageUp and PageDown move by ten lines. The Home and End key moves +to the top and the bottom of the list respectively. The return key +select the current line and quit. + +You can cancel the selection either by interrupting the command with +^C or by typing ^G. + .SH "OPTIONS" .IP "\fB-h\fP" 10 display help and exits .IP "\fB-v\fP" 10 inject the selected line into the tty input buffer +.IP "\fB-m\fP" 10 +force the monochrome mode .IP "\fB-t \fP" 10 select a color them .IP "\fB-o \fP" 10 diff --git a/selector.cc b/selector.cc index fbc4891..93a4611 100644 --- a/selector.cc +++ b/selector.cc @@ -49,7 +49,7 @@ int buffer_size = 1024; int nb_lines_max = 10000; char pattern_separator = ';'; int output_to_vt_buffer = 0; -int with_colors = 0; +int with_colors = 1; ////////////////////////////////////////////////////////////////////// @@ -329,6 +329,11 @@ int main(int argc, char **argv) { i++; } + else if(strcmp(argv[i], "-m") == 0) { + with_colors = 0; + i++; + } + else if(strcmp(argv[i], "-f") == 0) { check_opt(argc, argv, i, 1, ""); strncpy(input_filename, argv[i+1], buffer_size); @@ -361,6 +366,7 @@ int main(int argc, char **argv) { << " [-h]" << " [-b]" << " [-v]" + << " [-m]" << " [-t ]" << " [-o ]" << " [-s ]" @@ -402,19 +408,22 @@ int main(int argc, char **argv) { initscr(); - if(has_colors()) { - with_colors = 1; - start_color(); - switch(theme) { - default: - case 0: - init_pair(1, COLOR_WHITE, COLOR_GREEN); - init_pair(2, COLOR_BLACK, COLOR_YELLOW); - break; - case 1: - init_pair(1, COLOR_BLACK, COLOR_GREEN); - init_pair(2, COLOR_BLACK, COLOR_YELLOW); - break; + if(with_colors) { + if(has_colors()) { + start_color(); + switch(theme) { + default: + case 0: + init_pair(1, COLOR_WHITE, COLOR_GREEN); + init_pair(2, COLOR_BLACK, COLOR_YELLOW); + break; + case 1: + init_pair(1, COLOR_BLACK, COLOR_GREEN); + init_pair(2, COLOR_BLACK, COLOR_YELLOW); + break; + } + } else { + with_colors = 0; } } @@ -433,7 +442,7 @@ int main(int argc, char **argv) { int motion = 0; - if(key >= ' ' && key <= 'z') { + if(key >= ' ' && key <= '~') { patterns[patterns_point++] = key; patterns[patterns_point] = '\0'; }