aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/termiolink.c
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2014-06-30 21:48:55 +0200
committerBoris Faure <billiob@gmail.com>2014-06-30 21:48:55 +0200
commit371b402947c44ca4b85f58f27b132dbb5aedbec1 (patch)
treeab551284eb92f87d4b4b1b88d178f6a729e4c16b /src/bin/termiolink.c
parentmedia: add missing extension for media (diff)
downloadterminology-371b402947c44ca4b85f58f27b132dbb5aedbec1.tar.gz
fix link detection on end of lines
Diffstat (limited to 'src/bin/termiolink.c')
-rw-r--r--src/bin/termiolink.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bin/termiolink.c b/src/bin/termiolink.c
index 9e90b0f..cb734b0 100644
--- a/src/bin/termiolink.c
+++ b/src/bin/termiolink.c
@@ -101,7 +101,7 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
char *s;
char endmatch = 0;
int x1, x2, y1, y2, w = 0, h = 0, sc;
- size_t len;
+ size_t len, prev_len = 0;
Eina_Bool goback = EINA_TRUE, goforward = EINA_FALSE, escaped = EINA_FALSE;
x1 = x2 = cx;
@@ -111,6 +111,7 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
sc = termio_scroll_get(obj);
for (;;)
{
+ prev_len = len;
s = termio_selection_get(obj, x1, y1 - sc, x2, y2 - sc, &len);
if (!s) break;
if (goback)
@@ -123,6 +124,7 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
/* Check if the previous char is a delimiter */
coord_back(&x1, &y1, w, h);
free(s);
+ prev_len = len;
s = termio_selection_get(obj, x1, y1 - sc, x2, y2 - sc,
&len);
if (!s) break;
@@ -139,6 +141,7 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
coord_forward(&x1, &y1, w, h);
free(s);
+ prev_len = len;
s = termio_selection_get(obj, x1, y1 - sc, x2, y2 - sc,
&len);
if (!s) break;
@@ -170,6 +173,8 @@ _termio_link_find(Evas_Object *obj, int cx, int cy,
if ((goforward) && (len >= 1))
{
char end = s[len - 1];
+ if (len - prev_len == 2 && len >= 2)
+ end = s[len - 2];
if ((end == endmatch) ||
((!escaped) && (isspace(end)) &&