Automatic commit
[selector.git] / selector.cc
index fbc4891..93a4611 100644 (file)
@@ -49,7 +49,7 @@ int buffer_size = 1024;
 int nb_lines_max = 10000;
 char pattern_separator = ';';
 int output_to_vt_buffer = 0;
-int with_colors = 0;
+int with_colors = 1;
 
 //////////////////////////////////////////////////////////////////////
 
@@ -329,6 +329,11 @@ int main(int argc, char **argv) {
       i++;
     }
 
+    else if(strcmp(argv[i], "-m") == 0) {
+      with_colors = 0;
+      i++;
+    }
+
     else if(strcmp(argv[i], "-f") == 0) {
       check_opt(argc, argv, i, 1, "<input filename>");
       strncpy(input_filename, argv[i+1], buffer_size);
@@ -361,6 +366,7 @@ int main(int argc, char **argv) {
            << " [-h]"
            << " [-b]"
            << " [-v]"
+           << " [-m]"
            << " [-t <color theme number>]"
            << " [-o <output filename>]"
            << " [-s <pattern separator>]"
@@ -402,19 +408,22 @@ int main(int argc, char **argv) {
 
   initscr();
 
-  if(has_colors()) {
-    with_colors = 1;
-    start_color();
-    switch(theme) {
-    default:
-    case 0:
-      init_pair(1, COLOR_WHITE, COLOR_GREEN);
-      init_pair(2, COLOR_BLACK, COLOR_YELLOW);
-      break;
-    case 1:
-      init_pair(1, COLOR_BLACK, COLOR_GREEN);
-      init_pair(2, COLOR_BLACK, COLOR_YELLOW);
-      break;
+  if(with_colors) {
+    if(has_colors()) {
+      start_color();
+      switch(theme) {
+      default:
+      case 0:
+        init_pair(1, COLOR_WHITE, COLOR_GREEN);
+        init_pair(2, COLOR_BLACK, COLOR_YELLOW);
+        break;
+      case 1:
+        init_pair(1, COLOR_BLACK, COLOR_GREEN);
+        init_pair(2, COLOR_BLACK, COLOR_YELLOW);
+        break;
+      }
+    } else {
+      with_colors = 0;
     }
   }
 
@@ -433,7 +442,7 @@ int main(int argc, char **argv) {
 
     int motion = 0;
 
-    if(key >= ' ' && key <= 'z') {
+    if(key >= ' ' && key <= '~') {
       patterns[patterns_point++] = key;
       patterns[patterns_point] = '\0';
     }