X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/c584b893e1a1d9b4361d6f11605c46d102583572..d428e0289e70ff5725f7b606ce1a69bd96e110d3:/Display.cpp?ds=sidebyside diff --git a/Display.cpp b/Display.cpp index 5e45c45..555bd6d 100644 --- a/Display.cpp +++ b/Display.cpp @@ -72,9 +72,6 @@ CYCursor CYDisplayOutput(int (*put)(int), int width, const char *data, ssize_t o case CYIgnoreStart: CYDisplayOutput_(put, data); - ++offset; - break; - case CYIgnoreEnd: ++offset; break; @@ -90,19 +87,25 @@ CYCursor CYDisplayOutput(int (*put)(int), int width, const char *data, ssize_t o } } +} - return point; +void CYDisplayMove_(char *negative, char *positive, int offset) { + if (offset < 0) + putp(tparm(negative, -offset)); + else if (offset > 0) + putp(tparm(positive, offset)); } void CYDisplayMove(CYCursor target) { - int offset(target.real() - current_.real()); + CYCursor offset(target - current_); - if (offset < 0) - putp(tparm(parm_up_cursor, -offset)); - else if (offset > 0) - putp(tparm(parm_down_cursor, offset)); + CYDisplayMove_(parm_up_cursor, parm_down_cursor, offset.real()); + + if (char *parm = tparm(column_address, target.imag())) + putp(parm); + else + CYDisplayMove_(parm_left_cursor, parm_right_cursor, offset.imag()); - putp(tparm(column_address, target.imag())); current_ = target; }