agree st-clickurl with st-scrollback-ringbuffer and disable waitpid (handled by sigchld())

This commit is contained in:
2026-01-21 23:25:51 +01:00
parent 91f0a5a008
commit 9e0c60a428

14
st.c
View File

@@ -671,15 +671,15 @@ highlighturls(void)
for (int i = term.top; i < term.bot; i++) {
int url_start = -1;
for (int j = 0; j < term.col; j++) {
if (term.line[i][j].u < 127) {
linestr[j] = term.line[i][j].u;
if (TLINE(i)[j].u < 127) {
linestr[j] = TLINE(i)[j].u;
}
linestr[term.col] = '\0';
}
while ((match = strstrany(linestr + url_start + 1, urlprefixes))) {
url_start = match - linestr;
for (int c = url_start; c < term.col && strchr(urlchars, linestr[c]); c++) {
term.line[i][c].mode |= ATTR_URL;
TLINE(i)[c].mode |= ATTR_URL;
tsetdirt(i, c);
}
}
@@ -692,7 +692,7 @@ unhighlighturls(void)
{
for (int i = term.top; i < term.bot; i++) {
for (int j = 0; j < term.col; j++) {
Glyph* g = &term.line[i][j];
Glyph* g = &TLINE(i)[j];
if (g->mode & ATTR_URL) {
g->mode &= ~ATTR_URL;
tsetdirt(i, j);
@@ -707,8 +707,8 @@ followurl(int x, int y) {
char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */
char *match;
for (int i = 0; i < term.col; i++) {
if (term.line[x][i].u < 127) {
linestr[i] = term.line[x][i].u;
if (TLINE(x)[i].u < 127) {
linestr[i] = TLINE(x)[i].u;
}
linestr[term.col] = '\0';
}
@@ -735,8 +735,10 @@ followurl(int x, int y) {
execlp(urlhandler, urlhandler, linestr + url_start, NULL);
exit(1);
}
/* // handled by sigchld()
if (chpid > 0)
waitpid(chpid, NULL, 0);
*/
free(linestr);
unhighlighturls();
}