termiolink: handle tabs in (color) links

This commit is contained in:
Boris Faure 2020-05-29 23:05:21 +02:00
parent f23467407c
commit 2f040f9532
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
1 changed files with 30 additions and 1 deletions

View File

@ -234,6 +234,13 @@ _txt_at(Termpty *ty, int *x, int *y, char *txt, int *txtlenp, int *codepointp)
cell = cells[*x];
}
if (cell.att.tab_inserted)
{
*txtlenp = 1;
*codepointp = '\t';
txt[0] = '\t';
return 0;
}
if ((cell.codepoint == 0) || (cell.att.link_id))
goto empty;
@ -298,6 +305,17 @@ _txt_prev_at(Termpty *ty, int *x, int *y, char *txt, int *txtlenp,
cell = cells[*x];
}
if (cell.att.tab_last)
{
while (*x >= 0 && !cells[*x].att.tab_inserted)
(*x)--;
if (*x < 0)
goto bad;
*txtlenp = 1;
*codepointp = '\t';
txt[0] = '\t';
return 0;
}
if ((cell.codepoint == 0) || (cell.att.link_id))
goto empty;
@ -313,8 +331,8 @@ empty:
return 0;
bad:
*txtlenp = 0;
txt[0] = '\0';
*txtlenp = 0;
return -1;
}
@ -365,6 +383,17 @@ _txt_next_at(Termpty *ty, int *x, int *y, char *txt, int *txtlenp,
}
cell = cells[*x];
if (cell.att.tab_inserted)
{
while (*x < w && !cells[*x].att.tab_last)
(*x)++;
if (*x >= w)
goto bad;
*txtlenp = 1;
*codepointp = '\t';
txt[0] = '\t';
return 0;
}
if ((cell.codepoint == 0) || (cell.att.link_id))
goto empty;