]> git.saurik.com Git - cycript.git/blobdiff - Console.cpp
Upgrade copyright notice (2013, mk, sh, GPLv3).
[cycript.git] / Console.cpp
index 596f804b19b4472b6374297cf2a85a6b38de6411..99421d83a7128f1fd7e74ddb1642d7be29876e70 100644 (file)
@@ -1,20 +1,20 @@
 /* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2012  Jay Freeman (saurik)
+ * Copyright (C) 2009-2013  Jay Freeman (saurik)
 */
 
-/* GNU Lesser General Public License, Version 3 {{{ */
+/* GNU General Public License, Version 3 {{{ */
 /*
- * Cycript is free software: you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your
- * option) any later version.
+ * Cycript is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
  *
- * Cycript is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
- * License for more details.
+ * Cycript is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public License
+ * You should have received a copy of the GNU General Public License
  * along with Cycript.  If not, see <http://www.gnu.org/licenses/>.
 **/
 /* }}} */
@@ -64,6 +64,7 @@
 #include <dlfcn.h>
 
 #include "Replace.hpp"
+#include "Display.hpp"
 
 static volatile enum {
     Working,
@@ -404,7 +405,7 @@ static void Console(CYOptions &options) {
     bool bypass(false);
     bool debug(false);
     bool expand(false);
-    bool syntax(false);
+    bool syntax(true);
 
     out_ = &std::cout;
 
@@ -435,9 +436,23 @@ static void Console(CYOptions &options) {
         }
 
       read:
+
+#if RL_READLINE_VERSION >= 0x0600
+        if (syntax) {
+            rl_prep_term_function = CYDisplayStart;
+            rl_redisplay_function = CYDisplayUpdate;
+            rl_deprep_term_function = CYDisplayFinish;
+        } else {
+            rl_prep_term_function = rl_prep_terminal;
+            rl_redisplay_function = rl_redisplay;
+            rl_deprep_term_function = rl_deprep_terminal;
+        }
+#endif
+
         mode_ = Parsing;
         char *line(readline(prompt));
         mode_ = Working;
+
         if (line == NULL)
             break;
         if (line[0] == '\0')