From: Francois Fleuret <francois@fleuret.org>
Date: Wed, 11 Mar 2009 15:14:38 +0000 (+0100)
Subject: Automatic commit
X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=85c9e0fce6b7b4297235e6aed6c6cde05e83132e;p=selector.git

Automatic commit
---

diff --git a/selector.cc b/selector.cc
index a6eec47..4b41d07 100644
--- a/selector.cc
+++ b/selector.cc
@@ -264,13 +264,13 @@ int main(int argc, char **argv) {
   curs_set(1);
   endwin();
 
-  // ofstream out("/tmp/selector.out");
-  // if(key == KEY_ENTER || key == '\n') {
-    // out << lines[highlighted_line] << endl;
-  // } else {
-    // out << endl;
-  // }
-  // out.flush();
+  ofstream out("/tmp/selector.out");
+  if((key == KEY_ENTER || key == '\n') && line >= 0 && line < nb_lines) {
+    out << lines[line] << endl;
+  } else {
+    out << endl;
+  }
+  out.flush();
 
   for(int l = 0; l < nb_lines; l++) {
     delete[] lines[l];