From: Francois Fleuret Date: Fri, 13 Mar 2009 09:53:20 +0000 (+0100) Subject: Automatic commit X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=selector.git;a=commitdiff_plain;h=41927c77cc6c56eff6a76a646a8ab4d315c90b1b Automatic commit --- diff --git a/selector.1 b/selector.1 index 85e1cb5..dce6be2 100644 --- a/selector.1 +++ b/selector.1 @@ -34,6 +34,8 @@ display help and exits inject the selected line into the tty input buffer .IP "\fB-m\fP" 10 force the monochrome mode +.IP "\fB-z\fP" 10 +remove the time prefix from zsh history .IP "\fB-c \fP" 10 select the display colors for the modeline and the highlighted line .IP "\fB-o \fP" 10 diff --git a/selector.cc b/selector.cc index f909ba0..13eb43a 100644 --- a/selector.cc +++ b/selector.cc @@ -50,6 +50,7 @@ int nb_lines_max = 10000; char pattern_separator = ';'; int output_to_vt_buffer = 0; int with_colors = 1; +int zsh_history = 0; ////////////////////////////////////////////////////////////////////// @@ -384,6 +385,11 @@ int main(int argc, char **argv) { i++; } + else if(strcmp(argv[i], "-z") == 0) { + zsh_history = 1; + i++; + } + else if(strcmp(argv[i], "-l") == 0) { check_opt(argc, argv, i, 1, ""); nb_lines_max = atoi(argv[i+1]); @@ -408,6 +414,7 @@ int main(int argc, char **argv) { << " [-h]" << " [-v]" << " [-m]" + << " [-z]" << " [-c ]" << " [-o ]" << " [-s ]" @@ -437,8 +444,13 @@ int main(int argc, char **argv) { int nb_lines = 0; while(nb_lines < nb_lines_max && !file.eof()) { file.getline(buffer, buffer_size); - lines[nb_lines] = new char[strlen(buffer) + 1]; - strcpy(lines[nb_lines], buffer); + char *s = buffer; + if(zsh_history && *s == ':') { + s++; + while(*s && *s != ':') s++; + } + lines[nb_lines] = new char[strlen(s) + 1]; + strcpy(lines[nb_lines], s); nb_lines++; }