aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-01-12 16:12:04 +0100
committerBoris Faure <billiob@gmail.com>2019-01-12 16:14:14 +0100
commit505772602eecc2605de3513d46094d0e3c0357a3 (patch)
tree55862709a7e09b705dbe78321acfbba4b2f67e79 /src
parenttermptyesc: extract ECH handler to its own function + test (diff)
downloadterminology-505772602eecc2605de3513d46094d0e3c0357a3.tar.gz
termptyops: do not wrap to left margin when already past right margin
Fix ech.sh test that detected the issue
Diffstat (limited to 'src')
-rw-r--r--src/bin/termptyops.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 6b7bc9e..914fbb8 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -177,10 +177,7 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
Termcell *cells;
int i, j;
int origin = ty->termstate.left_margin;
- int max_right = ty->w;
- if (ty->termstate.right_margin)
- max_right = ty->termstate.right_margin;
/* TODO: have content_change_box*/
termio_content_change(ty->obj, ty->cursor_state.cx, ty->cursor_state.cy, len);
@@ -188,8 +185,15 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
cells = &(TERMPTY_SCREEN(ty, 0, ty->cursor_state.cy));
for (i = 0; i < len; i++)
{
+ int max_right = ty->w;
Eina_Unicode g;
+ if (ty->termstate.right_margin &&
+ (ty->cursor_state.cx < ty->termstate.right_margin))
+ {
+ max_right = ty->termstate.right_margin;
+ }
+
if (ty->termstate.wrapnext)
{
cells[max_right-1].att.autowrapped = 1;
@@ -228,6 +232,7 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
ty->termstate.combining_strike = 0;
cells[ty->cursor_state.cx].att.strike = 1;
}
+
cells[ty->cursor_state.cx].att.dblwidth = _termpty_is_dblwidth_get(ty, g);
if (EINA_UNLIKELY((cells[ty->cursor_state.cx].att.dblwidth) && (ty->cursor_state.cx < (max_right - 1))))
{
@@ -235,6 +240,7 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
termpty_cell_codepoint_att_fill(ty, 0, cells[ty->cursor_state.cx].att,
&(cells[ty->cursor_state.cx + 1]), 1);
}
+
if (ty->termstate.wrap)
{
unsigned char offset = 1;