edit the line and execute it as a standard command.
Selector is also a good tool to test regexps, or a way to display
-menus. The -x option allows to specify a label delimiter: Only the
-part of each line before that character will appear during the
-selection, but the full line will be returned.
+menus. The -x option allows to specify a label delimiter: the part of
+each line before that character will appear during the selection, and
+the part after that character will be returned.
.SH "KEYS"
.PP
specify the symbol to separate the substrings in the search pattern
.IP "\fB-x <label separator>\fP" 10
specify the symbol to separate what to show to the user during the
-selection from the rest of the line
+selection from the line to return
.IP "\fB-l <max number of lines>\fP" 10
specify the maximum number of lines to take into account
.IP "\fB-f <input filename>\fP" 10
if((key == KEY_ENTER || key == '\n')) {
- if(output_to_vt_buffer) {
- if(displayed_focus_line >= 0 && displayed_focus_line < nb_lines) {
- inject_into_tty_buffer(lines[displayed_focus_line]);
+ char *t;
+
+ if(displayed_focus_line >= 0 && displayed_focus_line < nb_lines) {
+ t = lines[displayed_focus_line];
+ if(label_separator) {
+ while(*t && *t != label_separator) t++;
+ if(*t) t++;
}
+ } else {
+ t = 0;
+ }
+
+ if(output_to_vt_buffer && t) {
+ inject_into_tty_buffer(t);
}
if(output_filename[0]) {
cerr << "Can not open " << output_filename << " for writing." << endl;
exit(1);
} else {
- if(displayed_focus_line >= 0 && displayed_focus_line < nb_lines) {
- out << lines[displayed_focus_line] << endl;
+ if(t) {
+ out << t << endl;
} else {
out << endl;
}