aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termptyesc.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-08-22 20:51:20 +0200
committerBoris Faure <billiob@gmail.com>2017-08-22 20:51:20 +0200
commit7c358c3592f01346d555c38daf01f34bcda9f545 (patch)
treee1bbfb0b3832bb91bc7b9122a92fe291de9d9d25 /src/bin/termptyesc.c
parenttermpty: remove termstate.had_cr since it's unused (diff)
downloadterminology-7c358c3592f01346d555c38daf01f34bcda9f545.tar.gz
termptyesc: correctly handle going to start of line when there is a left margin
Diffstat (limited to 'src/bin/termptyesc.c')
-rw-r--r--src/bin/termptyesc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index d2ca4fd..c71a893 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -151,6 +151,12 @@ _tab_forward(Termpty *ty, int n)
}
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)
{
switch (*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;