termptyesc: correctly handle going to start of line when there is a left margin

This commit is contained in:
Boris Faure 2017-08-22 20:51:20 +02:00
parent 6315ed2949
commit 7c358c3592
1 changed files with 9 additions and 2 deletions

View File

@ -150,6 +150,12 @@ _tab_forward(Termpty *ty, int n)
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, ty->w);
}
static void
_cursor_to_start_of_line(Termpty *ty)
{
ty->cursor_state.cx = ty->termstate.left_margin;
}
static void
_handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
{
@ -173,7 +179,8 @@ _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
case 0x0c: // FF '\f' (form feed)
DBG("->LF");
ty->termstate.wrapnext = 0;
if (ty->termstate.crlf) ty->cursor_state.cx = 0;
if (ty->termstate.crlf)
_cursor_to_start_of_line(ty);
ty->cursor_state.cy++;
termpty_text_scroll_test(ty, EINA_TRUE);
return;
@ -185,7 +192,7 @@ _handle_cursor_control(Termpty *ty, const Eina_Unicode *cc)
ty->termstate.had_cr_y = ty->cursor_state.cy;
ty->termstate.wrapnext = 0;
}
ty->cursor_state.cx = 0;
_cursor_to_start_of_line(ty);
return;
default:
return;