diff --git a/options.h b/options.h index 30fe492..71be6fd 100644 --- a/options.h +++ b/options.h @@ -106,7 +106,10 @@ static uint su_timeout = 200; /* Synchronized timeout in millisecon * * 'xdg-open' is the default but this could be set to 'firefox' or 'chrome'. */ -static char *url_opener = "xdg-open"; +static char *url_opener = "xdg-open"; /* Open the URL in this char */ + +static int clickeditalic = 1; /* Should clicked links show up as italic (1) or not (0) */ +static int clickedunderline = 1; /* Should clicked links show up underlined (1) or not (0) */ /* Color options */ static const char *colorname[] = { @@ -194,6 +197,8 @@ static char *understyle = "1"; /* Undercurl style to use */ /* Default column and row options */ static unsigned int cols = 80; /* Number of columns to have by default */ static unsigned int rows = 24; /* Number of rows to have by default */ +static unsigned int width = 564; +static unsigned int height = 364; /* Bell options */ static int bellvolume = 0; /* Bell volume. It must be a value between -100 and 100. 0 will disable it. */ diff --git a/st.c b/st.c index 9b0eebe..2e0e89d 100644 --- a/st.c +++ b/st.c @@ -3179,6 +3179,8 @@ openUrlOnClick(int col, int row, char* url_opener) int col_start = col; int row_end = row; int col_end = col; + int clickedunderline = clickedunderline; + int clickeditalic = clickeditalic; if (term.line[row][col].u == ' ') return; @@ -3226,6 +3228,20 @@ openUrlOnClick(int col, int row, char* url_opener) return; } + for (int i = col_start - strlen(url); i < col_start; i++) { + term.line[row_start][i].mode = ATTR_NULL; + } + + /* Italic clicked links */ + for (int i = col_start - strlen(url); i < col_start; i++ && clickeditalic) { + term.line[row_start][i].mode ^= ATTR_ITALIC; + } + + /* Underline clicked links */ + for (int i = col_start - strlen(url); i < col_start; i++ && clickedunderline) { + term.line[row_start][i].mode ^= ATTR_UNDERLINE; + } + char command[strlen(url_opener)+1+strlen(url)]; sprintf(command, "%s %s", url_opener, url); system(command);