X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/daf84f5ea916d698dd8a1bacf8aec1b296e20823..a7d8b4130acfb550e437d8cf1f6d3d81cb0cf6ee:/Display.cpp?ds=sidebyside diff --git a/Display.cpp b/Display.cpp index cafdc57..ed643f2 100644 --- a/Display.cpp +++ b/Display.cpp @@ -1,21 +1,21 @@ /* Cycript - Optimizing JavaScript Compiler/Runtime - * Copyright (C) 2009-2013 Jay Freeman (saurik) + * Copyright (C) 2009-2015 Jay Freeman (saurik) */ -/* GNU General Public License, Version 3 {{{ */ +/* GNU Affero General Public License, Version 3 {{{ */ /* - * 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 + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + + * This program 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 General Public License - * along with Cycript. If not, see . + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . **/ /* }}} */ @@ -38,6 +38,7 @@ typedef std::complex CYCursor; +extern "C" int rl_display_fixed; extern "C" int _rl_vis_botlin; extern "C" int _rl_last_c_pos; extern "C" int _rl_last_v_pos; @@ -115,12 +116,11 @@ void CYDisplayMove(CYCursor target) { current_ = target; } -void CYDisplayStart(int meta) { - rl_prep_terminal(meta); - current_ = CYCursor(); -} - void CYDisplayUpdate() { + rl_display_fixed = 1; + rl_redisplay(); + current_ = CYCursor(_rl_last_v_pos, _rl_last_c_pos); + #if RL_READLINE_VERSION >= 0x0600 const char *prompt(rl_display_prompt); #else @@ -144,12 +144,6 @@ void CYDisplayUpdate() { CYCursor target(CYDisplayOutput(putchar, width, stream.str().c_str(), rl_point)); _rl_vis_botlin = current_.real(); - _rl_last_c_pos = current_.imag(); - _rl_last_v_pos = target.real(); - - // XXX: readline crashes trying to avoid an empty line if this is left at 0 :( - if (_rl_last_c_pos == 0) - _rl_last_c_pos = 1; if (current_.imag() == 0) CYDisplayOutput(putchar, width, " "); @@ -158,12 +152,11 @@ void CYDisplayUpdate() { CYDisplayMove(target); fflush(stdout); + _rl_last_v_pos = current_.real(); + _rl_last_c_pos = current_.imag(); + width_ = width; point_ = rl_point; } -void CYDisplayFinish() { - rl_deprep_terminal(); -} - #endif