diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c index 6b7bc9e5..914fbb8b 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; diff --git a/tests/tests.results b/tests/tests.results index 31911376..557fe088 100644 --- a/tests/tests.results +++ b/tests/tests.results @@ -65,4 +65,5 @@ sd.sh 4bfda7ec3e6192acab077de2bc270525 decst8c.sh 0ea805e8f4c2626ce66c566a10548d0f ctc.sh d35eeacdb2e99f5ac8cc3c4e8d72f8b0 tbc.sh d0216e4056e5ab1cb4d411b6d6074785 -ech.sh 6257d40c467d63cc7883c380357d87f7 +ech.sh 57a3ff127abbb3efa4082fab7de59970 +text_append_after_right_margin.sh 26b334188d39e2b12538a6ca91ca168c diff --git a/tests/text_append_after_right_margin.sh b/tests/text_append_after_right_margin.sh new file mode 100755 index 00000000..4056bb12 --- /dev/null +++ b/tests/text_append_after_right_margin.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# fill space with E +printf '\033[69;1;1;25;80\044x' +#set color +printf '\033[46;31;3m' + +# set top/bottom margins: +printf '\033[10;20r' +# allow left/right margins +printf '\033[?69h' +# set left/right margins: +printf '\033[5;15s' +# fill margin with @ +printf '\033[64;10;5;20;15\044x' + +# move +printf '\033[10;15H' +printf '>>>>>>>' +# move +printf '\033[12;16H' +printf '#######' + +# move +printf '\033[12;70H' +printf 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' + +# move +printf '\033[15;7H' +printf 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz' + + + +# set left/right margins: +printf '\033[25;35s' +# fill margin with @ +printf '\033[64;10;25;20;35\044x' +# restrict cursor +printf '\033[?6h' +# move +printf '\033[6;6H' +printf 'gggggggggggggggggggggggggggggggggggggggggggggggggg'