termiointernals: right-trim line selections

This commit is contained in:
Boris Faure 2019-02-18 22:04:37 +01:00
parent 75e4825045
commit f93f1ef3ba
1 changed files with 10 additions and 1 deletions

View File

@ -389,7 +389,7 @@ end:
static void
_sel_line(Termio *sd, int cy)
{
int y;
int x, y;
ssize_t w = 0;
Termcell *cells;
@ -424,6 +424,15 @@ _sel_line(Termio *sd, int cy)
sd->pty->selection.end.x = w - 1;
y++;
}
/* Right trim */
x = sd->pty->selection.end.x;
while (x > 0 && ((cells[x].codepoint == 0) ||
(cells[x].codepoint == ' ') ||
(cells[x].att.newline)))
{
x--;
}
sd->pty->selection.end.x = x;
sd->pty->selection.end.y = y;
sd->pty->selection.by_line = EINA_TRUE;