X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/c15969fd0a6280c60d2f35876b5343004fed2b11..13c7f2fb8fc0619c8da1b5c8a697f7894479b070:/Display.cpp?ds=sidebyside diff --git a/Display.cpp b/Display.cpp index d76ac1f..bd646bb 100644 --- a/Display.cpp +++ b/Display.cpp @@ -28,6 +28,8 @@ #include #endif +#if RL_READLINE_VERSION >= 0x0600 + #include #include "Highlight.hpp" @@ -36,6 +38,11 @@ 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; + CYCursor current_; int width_; size_t point_; @@ -109,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 @@ -137,6 +143,8 @@ void CYDisplayUpdate() { CYDisplayOutput(putchar, width, prompt); CYCursor target(CYDisplayOutput(putchar, width, stream.str().c_str(), rl_point)); + _rl_vis_botlin = current_.real(); + if (current_.imag() == 0) CYDisplayOutput(putchar, width, " "); putp(clr_eos); @@ -144,10 +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