X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=selector.cc;h=739f6f8bfb1b7c6064b3294f06862098938ea0d3;hb=9ab9a82ad64fc9728d898217f6e661166f5632ed;hp=8e03818cc7b3cfb5c3b020b14b01655c96dc438c;hpb=193d8265f2564e72db271c3bcbd65ed8d8d8fc9a;p=selector.git diff --git a/selector.cc b/selector.cc index 8e03818..739f6f8 100644 --- a/selector.cc +++ b/selector.cc @@ -890,8 +890,10 @@ int main(int argc, char **argv) { // Here we start to display with curse initscr(); - + cbreak(); noecho(); + // nonl(); + intrflush(stdscr, FALSE); // So that the arrow keys work keypad(stdscr, TRUE); @@ -1037,10 +1039,20 @@ int main(int argc, char **argv) { 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]) { @@ -1049,8 +1061,8 @@ int main(int argc, char **argv) { 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; }