get the column from the char attr struct too
This commit is contained in:
parent
8ebe3ec620
commit
e513f2ccd2
17
termite.cc
17
termite.cc
|
@ -49,7 +49,7 @@ struct search_panel_info {
|
||||||
struct url_data {
|
struct url_data {
|
||||||
char *url;
|
char *url;
|
||||||
long line;
|
long line;
|
||||||
int pos;
|
long pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct config_info {
|
struct config_info {
|
||||||
|
@ -111,18 +111,15 @@ static void find_urls(VteTerminal *vte) {
|
||||||
g_regex_match_full(regex, token, -1, 0, (GRegexMatchFlags)0, &info, &error);
|
g_regex_match_full(regex, token, -1, 0, (GRegexMatchFlags)0, &info, &error);
|
||||||
while (g_match_info_matches(info)) {
|
while (g_match_info_matches(info)) {
|
||||||
url_data node;
|
url_data node;
|
||||||
|
|
||||||
node.url = g_match_info_fetch(info, 0);
|
node.url = g_match_info_fetch(info, 0);
|
||||||
g_match_info_fetch_pos(info, 0, &node.pos, NULL);
|
|
||||||
|
int pos;
|
||||||
|
g_match_info_fetch_pos(info, 0, &pos, NULL);
|
||||||
|
|
||||||
const long first_row = g_array_index(attributes, vte_char_attributes, 0).row;
|
const long first_row = g_array_index(attributes, vte_char_attributes, 0).row;
|
||||||
node.line = g_array_index(attributes, vte_char_attributes, token + node.pos - content).row - first_row;
|
const vte_char_attributes attr = g_array_index(attributes, vte_char_attributes, token + pos - content);
|
||||||
|
node.line = attr.row - first_row;
|
||||||
const char c = token[node.pos];
|
node.pos = attr.column;
|
||||||
token[node.pos] = '\0';
|
|
||||||
const long len = g_utf8_strlen(token, -1);
|
|
||||||
token[node.pos] = c;
|
|
||||||
node.pos = static_cast<int>(len);
|
|
||||||
|
|
||||||
url_list.push_back(node);
|
url_list.push_back(node);
|
||||||
g_match_info_next(info, &error);
|
g_match_info_next(info, &error);
|
||||||
|
|
Loading…
Reference in New Issue