termptyesc: correctly handle missing arguments in CUP/HVP

This commit is contained in:
Boris Faure 2017-06-01 23:33:58 +02:00
parent e0f6867a88
commit 91ce6e8960
1 changed files with 5 additions and 12 deletions

View File

@ -858,21 +858,14 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, Eina_Unicode *ce)
if (arg < 1) arg = 1;
arg--;
if (arg >= ty->h) arg = ty->h - 1;
if (b)
{
ty->cursor_state.cy = arg;
arg = _csi_arg_get(&b);
if (arg < 1) arg = 1;
arg--;
}
else arg = 0;
if (arg >= ty->w) arg = ty->w - 1;
if (b)
{
ty->cursor_state.cx = arg;
}
}
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
if (ty->termstate.restrict_cursor)
ty->cursor_state.cy += ty->termstate.top_margin;