st-flexipatch

My st-flexipatch configuration
git clone git://git.ethandl.dev/st-flexipatch
Log | Files | Refs | README | LICENSE

commit 3b88d65645ebc89f662d1b17e43a2e582d69c199
parent a5435903d4eceea128fdb159489339d42600c191
Author: bakkeby <bakkeby@gmail.com>
Date:   Sun,  9 May 2021 08:08:51 +0200

copyurl: upgrading to support non-ascii URLs ref. #21

Diffstat:
Mpatch/copyurl.c | 9++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/patch/copyurl.c b/patch/copyurl.c @@ -54,7 +54,7 @@ copyurl(const Arg *arg) { colend = 0, /* column of last occurrence */ passes = 0; /* how many rows have been scanned */ - char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */ + char *linestr = calloc(term.col+1, sizeof(Rune)); char *c = NULL, *match = NULL; @@ -74,9 +74,6 @@ copyurl(const Arg *arg) { ** we hit previous occurrence of URL */ for (col = 0, i = 0; col < colend; ++col,++i) { - /* assume ascii */ - if (term.line[row][col].u > 127) - continue; linestr[i] = term.line[row][col].u; } linestr[term.col] = '\0'; @@ -135,7 +132,7 @@ copyurl(const Arg *arg) { "0123456789-._~:/?#@!$&'*+,;=%"; int i, row, startrow; - char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */ + char *linestr = calloc(term.col+1, sizeof(Rune)); char *c, *match = NULL; row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y-1 : term.bot; @@ -145,8 +142,6 @@ copyurl(const Arg *arg) { /* find the start of the last url before selection */ do { for (i = 0; i < term.col; ++i) { - if (term.line[row][i].u > 127) /* assume ascii */ - continue; linestr[i] = term.line[row][i].u; } linestr[term.col] = '\0';