Automatic commit
[selector.git] / selector.cc
index 8e03818..2dadb5d 100644 (file)
@@ -791,7 +791,7 @@ int main(int argc, char **argv) {
          << " -z      remove the zsh history line prefix" << endl
          << " -i      invert the order of lines" << endl
          << " -e      start in regexp mode" << endl
-         << " -a      case sensitive" << endl
+         << " -a      start in case sensitive mode" << endl
          << " -m      monochrome mode" << endl
          << " -q      make a flash instead of a beep on an edition error" << endl
          << " --      all following arguments are filenames" << endl
@@ -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;
         }