termptyesc: fix _clean_up_rect_coordinates() when cursor is restricted

This commit is contained in:
Boris Faure 2018-11-22 20:10:16 +01:00
parent 3751ce8083
commit 2db4a0e980
1 changed files with 13 additions and 5 deletions

View File

@ -1066,14 +1066,22 @@ _clean_up_rect_coordinates(Termpty *ty,
int right = *right_ptr;
TERMPTY_RESTRICT_FIELD(top, 1, ty->h);
top--;
if (ty->termstate.restrict_cursor)
top += ty->termstate.top_margin;
{
top += ty->termstate.top_margin;
if (ty->termstate.bottom_margin && top >= ty->termstate.bottom_margin)
top = ty->termstate.bottom_margin;
}
top--;
TERMPTY_RESTRICT_FIELD(left, 1, ty->w);
left--;
if (ty->termstate.restrict_cursor)
left += ty->termstate.left_margin;
{
left += ty->termstate.left_margin;
if (ty->termstate.right_margin && left >= ty->termstate.right_margin)
left = ty->termstate.right_margin;
}
left--;
if (right < 1)
right = ty->w;
@ -1092,7 +1100,7 @@ _clean_up_rect_coordinates(Termpty *ty,
{
bottom += ty->termstate.top_margin;
if (ty->termstate.bottom_margin && bottom >= ty->termstate.bottom_margin)
bottom = ty->termstate.bottom_margin - 1;
bottom = ty->termstate.bottom_margin;
}
bottom--;
if (bottom > ty->h)