termiointernals: skip invisible codepoints when assessing whether they changed

This commit is contained in:
Boris Faure 2020-05-03 21:55:33 +02:00
parent 19ffa91f15
commit 38e4935427
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
1 changed files with 9 additions and 3 deletions

View File

@ -2145,7 +2145,9 @@ termio_internal_mouse_move(Termio *sd,
{ {
if ((cx != start_x) || if ((cx != start_x) ||
((cy - sd->scroll) != start_y)) ((cy - sd->scroll) != start_y))
termio_sel_set(sd, EINA_TRUE); {
termio_sel_set(sd, EINA_TRUE);
}
} }
if (sd->pty->selection.by_line) if (sd->pty->selection.by_line)
@ -2416,7 +2418,6 @@ termio_internal_render(Termio *sd,
const char *preedit_str; const char *preedit_str;
ssize_t w; ssize_t w;
int sel_start_x = 0, sel_start_y = 0, sel_end_x = 0, sel_end_y = 0; int sel_start_x = 0, sel_start_y = 0, sel_end_x = 0, sel_end_y = 0;
Eina_Unicode *cp;
Termblock *blk; Termblock *blk;
Eina_List *l; Eina_List *l;
@ -2440,13 +2441,13 @@ termio_internal_render(Termio *sd,
INT_SWAP(sel_start_y, sel_end_y); INT_SWAP(sel_start_y, sel_end_y);
INT_SWAP(sel_start_x, sel_end_x); INT_SWAP(sel_start_x, sel_end_x);
} }
cp = sd->pty->selection.codepoints;
/* Look at every visible line */ /* Look at every visible line */
for (y = 0; y < sd->grid.h; y++) for (y = 0; y < sd->grid.h; y++)
{ {
Termcell *cells; Termcell *cells;
Evas_Textgrid_Cell *tc; Evas_Textgrid_Cell *tc;
Eina_Unicode *cp = NULL;
int cur_sel_start_x = -1, cur_sel_end_x = -1; int cur_sel_start_x = -1, cur_sel_end_x = -1;
int rel_y = y - sd->scroll; int rel_y = y - sd->scroll;
int l1 = -1, l2 = -1; int l1 = -1, l2 = -1;
@ -2462,15 +2463,18 @@ termio_internal_render(Termio *sd,
/* Compute @cur_sel_start_x, @cur_sel_end_x */ /* Compute @cur_sel_start_x, @cur_sel_end_x */
if (sd->pty->selection.codepoints) if (sd->pty->selection.codepoints)
{ {
cp = sd->pty->selection.codepoints;
if (sel_start_y <= rel_y && rel_y <= sel_end_y) if (sel_start_y <= rel_y && rel_y <= sel_end_y)
{ {
if (sd->pty->selection.is_box) if (sd->pty->selection.is_box)
{ {
cp += (rel_y - sel_start_y) * (sel_end_x - sel_start_x + 1);
cur_sel_start_x = sel_start_x; cur_sel_start_x = sel_start_x;
cur_sel_end_x = sel_end_x; cur_sel_end_x = sel_end_x;
} }
else else
{ {
cp += (rel_y - sel_start_y) * sd->pty->w;
cur_sel_start_x = sel_start_x; cur_sel_start_x = sel_start_x;
cur_sel_end_x = sel_end_x; cur_sel_end_x = sel_end_x;
if (sel_start_y != sel_end_y) if (sel_start_y != sel_end_y)
@ -2481,10 +2485,12 @@ termio_internal_render(Termio *sd,
} }
else if (rel_y == sel_end_y) else if (rel_y == sel_end_y)
{ {
cp -= sel_start_x;
cur_sel_start_x = 0; cur_sel_start_x = 0;
} }
else else
{ {
cp -= sel_start_x;
cur_sel_start_x = 0; cur_sel_start_x = 0;
cur_sel_end_x = sd->grid.w - 1; cur_sel_end_x = sd->grid.w - 1;
} }