diff -Nru terminology-1.3.0/ChangeLog terminology-1.3.2/ChangeLog --- terminology-1.3.0/ChangeLog 2018-11-23 18:41:17.000000000 +0000 +++ terminology-1.3.2/ChangeLog 2018-12-18 20:16:17.000000000 +0000 @@ -1,3 +1,16 @@ +2018-12-18 + * Release v1.3.2 + * Clicking on links works again + + +2018-12-16 + + * Release v1.3.1 + * Add manpages on Terminology's helpers + * Do not popup unknown media types (security issue) + * Right-click on hyperlinks no longer crashes + + 2018-11-23 * Release v1.3.0 diff -Nru terminology-1.3.0/debian/changelog terminology-1.3.2/debian/changelog --- terminology-1.3.0/debian/changelog 2018-11-25 22:44:15.000000000 +0000 +++ terminology-1.3.2/debian/changelog 2018-12-23 05:42:47.000000000 +0000 @@ -1,3 +1,19 @@ +terminology (1.3.2-1) unstable; urgency=low + + * New upstream version 1.3.2. + * Simplify watchfile by using @ARCHIVE_EXT@. + + -- Andreas Metzler Sun, 23 Dec 2018 06:42:47 +0100 + +terminology (1.3.1-1) unstable; urgency=high + + * New upstream release. + + Fix for CVE-2018-20167: Disable special escape handling for unknown media + types (Closes: #916630). + * d/p/0002-Minor-manpage-improvements.patch: drop, applied upstream + + -- Ross Vandegrift Sun, 16 Dec 2018 10:28:36 -0800 + terminology (1.3.0-1) unstable; urgency=medium * New upstream release. diff -Nru terminology-1.3.0/debian/patches/0002-Minor-manpage-improvements.patch terminology-1.3.2/debian/patches/0002-Minor-manpage-improvements.patch --- terminology-1.3.0/debian/patches/0002-Minor-manpage-improvements.patch 2018-11-25 22:44:15.000000000 +0000 +++ terminology-1.3.2/debian/patches/0002-Minor-manpage-improvements.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ -Description: Minor manpage improvements - This adds a manpage for the ty* helpers and fixes the terminology header. -Author: Ross Vandegrift -Origin: other -Forwarded: https://phab.enlightenment.org/D7356 -Last-Update: 2018-06-16 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ - -From: Ross Vandegrift -Date: Sat, 5 May 2018 11:15:38 -0700 -Subject: Minor manpage improvements - -- Add basic man page for ty helpers -- Fix terminology(1) header ---- - man/meson.build | 7 +++++++ - man/terminology-helpers.1 | 49 +++++++++++++++++++++++++++++++++++++++++++++++ - man/terminology.1 | 2 +- - man/tyalpha.1 | 1 + - man/tybg.1 | 1 + - man/tycat.1 | 1 + - man/tyls.1 | 1 + - man/typop.1 | 1 + - man/tyq.1 | 1 + - man/tysend.1 | 1 + - 10 files changed, 64 insertions(+), 1 deletion(-) - create mode 100644 man/terminology-helpers.1 - create mode 100644 man/tyalpha.1 - create mode 100644 man/tybg.1 - create mode 100644 man/tycat.1 - create mode 100644 man/tyls.1 - create mode 100644 man/typop.1 - create mode 100644 man/tyq.1 - create mode 100644 man/tysend.1 - ---- a/man/meson.build -+++ b/man/meson.build -@@ -1 +1,9 @@ - install_man('terminology.1') -+install_man('terminology-helpers.1') -+install_man('tyls.1') -+install_man('tyalpha.1') -+install_man('tybg.1') -+install_man('tycat.1') -+install_man('typop.1') -+install_man('tyq.1') -+install_man('tysend.1') ---- /dev/null -+++ b/man/terminology-helpers.1 -@@ -0,0 +1,49 @@ -+.\" Manpage for terminology helpers -+.TH TERMINOLOGY-HELPERS 1 "May 5 2018" -+.SH NAME -+terminiology-helpers \- programs that enhance -+.B terminology(1) -+.SH SYNOPSIS -+.TP -+.B tyls [-h] [-a] [-s|-m] FILE1 [FILE2 ...] -+List directory contents with bells and whistles -+. -+.TP -+.B tyalpha [-h][-p] on|off| -+Set transparency level of the background -+. -+.TP -+.B tybg [-h] [-p] [FILE1 FILE2 ...] -+Change the background image -+. -+.TP -+.B tycat [-h] [-s|-f|-c] [-g x] FILE1 [FILE2 ...] -+Display inline a media file or a URI -+. -+.TP -+.B typop [-h] FILE1 [FILE2 ...] -+Display in a popup a media file or a URI -+. -+.TP -+.B tyq [-h] FILE1 [FILE2 ...] -+Queue media files or URI to be popped up -+. -+.TP -+.B tysend [-h] FILE1 [FILE2 ...] -+Send files to the terminal (useful through ssh) -+ -+.SH DESCRIPTION -+.PP -+Terminology provides a number of companion tools to control advanced -+behavior. They allow in-line and popup display of media files, -+enhanced file listing, and control over visual appearance. -+ -+The escape codes used to implement these behaviors are documented in -+.B EXTENDED ESCAPES FOR TERMINOLOGY -+section of -+.BR terminology (1). -+.SH SEE ALSO -+.BR terminology (1), -+ -+.SH AUTHOR -+Terminology was written by Carsten Haitzler and others. It is maintained by Boris Faure and others. See AUTHORS file for other contributors. ---- a/man/terminology.1 -+++ b/man/terminology.1 -@@ -1,5 +1,5 @@ - .\" Manpage for Terminology --.TH man 1 "23 Nov 2018" "1.3.0" "Terminology man page" -+.TH TERMINOLOGY 1 "23 Nov 2018" "1.3.0" "Terminology man page" - .SH NAME - Terminology \- Terminal Emulator written with EFL (Enlightenment Foundation Libraries). - .SH SYNOPSIS ---- /dev/null -+++ b/man/tyalpha.1 -@@ -0,0 +1 @@ -+.so man1/terminology-helpers.1 ---- /dev/null -+++ b/man/tybg.1 -@@ -0,0 +1 @@ -+.so man1/terminology-helpers.1 ---- /dev/null -+++ b/man/tycat.1 -@@ -0,0 +1 @@ -+.so man1/terminology-helpers.1 ---- /dev/null -+++ b/man/tyls.1 -@@ -0,0 +1 @@ -+.so man1/terminology-helpers.1 ---- /dev/null -+++ b/man/typop.1 -@@ -0,0 +1 @@ -+.so man1/terminology-helpers.1 ---- /dev/null -+++ b/man/tyq.1 -@@ -0,0 +1 @@ -+.so man1/terminology-helpers.1 ---- /dev/null -+++ b/man/tysend.1 -@@ -0,0 +1 @@ -+.so man1/terminology-helpers.1 diff -Nru terminology-1.3.0/debian/patches/series terminology-1.3.2/debian/patches/series --- terminology-1.3.0/debian/patches/series 2018-11-25 22:44:15.000000000 +0000 +++ terminology-1.3.2/debian/patches/series 2018-12-22 10:18:57.000000000 +0000 @@ -1,2 +1 @@ fix-del-backspace-key.patch -0002-Minor-manpage-improvements.patch diff -Nru terminology-1.3.0/debian/watch terminology-1.3.2/debian/watch --- terminology-1.3.0/debian/watch 2018-05-01 05:48:02.000000000 +0000 +++ terminology-1.3.2/debian/watch 2018-12-22 10:52:48.000000000 +0000 @@ -1,2 +1,2 @@ version=3 -https://download.enlightenment.org/rel/apps/terminology/terminology-([\d\.]+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) +https://download.enlightenment.org/rel/apps/terminology/terminology-([\d\.]+)@ARCHIVE_EXT@ diff -Nru terminology-1.3.0/man/meson.build terminology-1.3.2/man/meson.build --- terminology-1.3.0/man/meson.build 2018-11-23 18:41:18.000000000 +0000 +++ terminology-1.3.2/man/meson.build 2018-12-18 20:16:17.000000000 +0000 @@ -1 +1,9 @@ install_man('terminology.1') +install_man('terminology-helpers.1') +install_man('tyls.1') +install_man('tyalpha.1') +install_man('tybg.1') +install_man('tycat.1') +install_man('typop.1') +install_man('tyq.1') +install_man('tysend.1') diff -Nru terminology-1.3.0/man/terminology.1 terminology-1.3.2/man/terminology.1 --- terminology-1.3.0/man/terminology.1 2018-11-23 18:41:18.000000000 +0000 +++ terminology-1.3.2/man/terminology.1 2018-12-18 20:16:17.000000000 +0000 @@ -1,5 +1,5 @@ .\" Manpage for Terminology -.TH man 1 "23 Nov 2018" "1.3.0" "Terminology man page" +.TH TERMINOLOGY 1 "18 Dec 2018" "1.3.2" "Terminology man page" .SH NAME Terminology \- Terminal Emulator written with EFL (Enlightenment Foundation Libraries). .SH SYNOPSIS @@ -524,17 +524,17 @@ \fBic[CW;H;FULL\-PATH\-OR\-URL]\fP insert CENTERED media (centered in cell area). Otherwise - paramaters are identical to the \fBis\fP command, but + parameters are identical to the \fBis\fP command, but retains aspect and is padded by blank space. \fBif[CW;H;FULL\-PATH\-OR\-URL]\fP - insert FILLED media (fill in cell area). Otherwise paramaters + insert FILLED media (fill in cell area). Otherwise parameters are identical to the \fBis\fP command but ensures the entire area is filled like a background even if media goes beyond cell bounds and is clipped. \fBit[CW;H;FULL\-PATH\-OR\-URL]\fP - insert THUMB media (thumbnail cell area). Otherwise paramaters + insert THUMB media (thumbnail cell area). Otherwise parameters are identical to the \fBis\fP command, but uses thumbnail generation to make a fast to load but low resolution version (cached) of the media. @@ -564,16 +564,16 @@ ;CHID\\ndrag,step\\nPART NAME\\nVAL1\\nVAL2 ;CHID\\drag,set\\nPART NAME\\nVAL1\\nVAL2 signal;CHID\\nSIGNAL STRING\\nSOURCE STRING - message;CHID\nOPCODE ID\nstring\\nSTRING1 - message;CHID\nOPCODE ID\nint\\nINT1 - message;CHID\nOPCODE ID\nfloat\\nFLOAT1 - message;CHID\nOPCODE ID\nstring_set\\nSTRING1\\nSTRING2\\nSTRING3... - message;CHID\nOPCODE ID\nint_set\\nINT1\\nINT2\\nINT3... - message;CHID\nOPCODE ID\nfloat_set\\nFLOAT1\\nFLOAT2\\nFLOAT3... - message;CHID\nOPCODE ID\nstring_int\\nSTRING1\\nINT1 - message;CHID\nOPCODE ID\nstring_float\\nSTRING1\\nFLOAT1 - message;CHID\nOPCODE ID\nstring_int_set\\nSTRING1\\nINT1\\nINT2\\nINT3... - message;CHID\nOPCODE ID\nstring_float_set\\nSTRING1\\nFLOAT1\\nFLOAT2\\nFLOAT3... + message;CHID\\nOPCODE ID\\nstring\\nSTRING1 + message;CHID\\nOPCODE ID\\nint\\nINT1 + message;CHID\\nOPCODE ID\\nfloat\\nFLOAT1 + message;CHID\\nOPCODE ID\\nstring_set\\nSTRING1\\nSTRING2\\nSTRING3... + message;CHID\\nOPCODE ID\\nint_set\\nINT1\\nINT2\\nINT3... + message;CHID\\nOPCODE ID\\nfloat_set\\nFLOAT1\\nFLOAT2\\nFLOAT3... + message;CHID\\nOPCODE ID\\nstring_int\\nSTRING1\\nINT1 + message;CHID\\nOPCODE ID\\nstring_float\\nSTRING1\\nFLOAT1 + message;CHID\\nOPCODE ID\\nstring_int_set\\nSTRING1\\nINT1\\nINT2\\nINT3... + message;CHID\\nOPCODE ID\\nstring_float_set\\nSTRING1\\nFLOAT1\\nFLOAT2\\nFLOAT3... \fBiC[CHID]\\n[cmd1][\\r\\n][cmd2][\\r\\n][cmd3]...\fP send a COMMAND (\fBcmd1, cmd2, cmd3\fP etc.) to an existing named @@ -611,13 +611,13 @@ \fBstring\fP: \fBSTRING1\fP \fBint\fP: \fBINT1\fP \fBfloat\fP: \fBFLOAT1\fP - \fBstring_set\fP: \fBSTRING1\nSTRING2\nSTRING3...\fP - \fBint_set\fP: \fBINT1\nINT2\nINT3...\fP - \fBfloat_set\fP: \fBFLOAT1\nFLOAT2\nFLOAT3...\fP - \fBstring_int\fP: \fBSTRING1\nINT1\fP - \fBstring_float\fP: \fBSTRING1\nFLOAT1\fP - \fBstring_int_set\fP: \fBSTRING1\nINT1\nINT2\nINT3...\fP - \fBstring_float_set\fP: \fBSTRING1\nFLOAT1\nFLOAT2\nFLOAT3...\fP + \fBstring_set\fP: \fBSTRING1\\nSTRING2\\nSTRING3...\fP + \fBint_set\fP: \fBINT1\\nINT2\\nINT3...\fP + \fBfloat_set\fP: \fBFLOAT1\\nFLOAT2\\nFLOAT3...\fP + \fBstring_int\fP: \fBSTRING1\\nINT1\fP + \fBstring_float\fP: \fBSTRING1\\nFLOAT1\fP + \fBstring_int_set\fP: \fBSTRING1\\nINT1\\nINT2\\nINT3...\fP + \fBstring_float_set\fP: \fBSTRING1\\nFLOAT1\\nFLOAT2\\nFLOAT3...\fP \fBib\fP begin media replace sequence run. diff -Nru terminology-1.3.0/man/terminology-helpers.1 terminology-1.3.2/man/terminology-helpers.1 --- terminology-1.3.0/man/terminology-helpers.1 1970-01-01 00:00:00.000000000 +0000 +++ terminology-1.3.2/man/terminology-helpers.1 2018-12-18 20:16:17.000000000 +0000 @@ -0,0 +1,49 @@ +.\" Manpage for terminology helpers +.TH TERMINOLOGY-HELPERS 1 "May 5 2018" +.SH NAME +terminiology-helpers \- programs that enhance +.B terminology(1) +.SH SYNOPSIS +.TP +.B tyls [-h] [-a] [-s|-m] FILE1 [FILE2 ...] +List directory contents with bells and whistles +. +.TP +.B tyalpha [-h][-p] on|off| +Set transparency level of the background +. +.TP +.B tybg [-h] [-p] [FILE1 FILE2 ...] +Change the background image +. +.TP +.B tycat [-h] [-s|-f|-c] [-g x] FILE1 [FILE2 ...] +Display inline a media file or a URI +. +.TP +.B typop [-h] FILE1 [FILE2 ...] +Display in a popup a media file or a URI +. +.TP +.B tyq [-h] FILE1 [FILE2 ...] +Queue media files or URI to be popped up +. +.TP +.B tysend [-h] FILE1 [FILE2 ...] +Send files to the terminal (useful through ssh) + +.SH DESCRIPTION +.PP +Terminology provides a number of companion tools to control advanced +behavior. They allow in-line and popup display of media files, +enhanced file listing, and control over visual appearance. + +The escape codes used to implement these behaviors are documented in +.B EXTENDED ESCAPES FOR TERMINOLOGY +section of +.BR terminology (1). +.SH SEE ALSO +.BR terminology (1), + +.SH AUTHOR +Terminology was written by Carsten Haitzler and others. It is maintained by Boris Faure and others. See AUTHORS file for other contributors. diff -Nru terminology-1.3.0/man/tyalpha.1 terminology-1.3.2/man/tyalpha.1 --- terminology-1.3.0/man/tyalpha.1 1970-01-01 00:00:00.000000000 +0000 +++ terminology-1.3.2/man/tyalpha.1 2018-12-18 20:16:17.000000000 +0000 @@ -0,0 +1 @@ +.so man1/terminology-helpers.1 diff -Nru terminology-1.3.0/man/tybg.1 terminology-1.3.2/man/tybg.1 --- terminology-1.3.0/man/tybg.1 1970-01-01 00:00:00.000000000 +0000 +++ terminology-1.3.2/man/tybg.1 2018-12-18 20:16:17.000000000 +0000 @@ -0,0 +1 @@ +.so man1/terminology-helpers.1 diff -Nru terminology-1.3.0/man/tycat.1 terminology-1.3.2/man/tycat.1 --- terminology-1.3.0/man/tycat.1 1970-01-01 00:00:00.000000000 +0000 +++ terminology-1.3.2/man/tycat.1 2018-12-18 20:16:17.000000000 +0000 @@ -0,0 +1 @@ +.so man1/terminology-helpers.1 diff -Nru terminology-1.3.0/man/tyls.1 terminology-1.3.2/man/tyls.1 --- terminology-1.3.0/man/tyls.1 1970-01-01 00:00:00.000000000 +0000 +++ terminology-1.3.2/man/tyls.1 2018-12-18 20:16:17.000000000 +0000 @@ -0,0 +1 @@ +.so man1/terminology-helpers.1 diff -Nru terminology-1.3.0/man/typop.1 terminology-1.3.2/man/typop.1 --- terminology-1.3.0/man/typop.1 1970-01-01 00:00:00.000000000 +0000 +++ terminology-1.3.2/man/typop.1 2018-12-18 20:16:17.000000000 +0000 @@ -0,0 +1 @@ +.so man1/terminology-helpers.1 diff -Nru terminology-1.3.0/man/tyq.1 terminology-1.3.2/man/tyq.1 --- terminology-1.3.0/man/tyq.1 1970-01-01 00:00:00.000000000 +0000 +++ terminology-1.3.2/man/tyq.1 2018-12-18 20:16:17.000000000 +0000 @@ -0,0 +1 @@ +.so man1/terminology-helpers.1 diff -Nru terminology-1.3.0/man/tysend.1 terminology-1.3.2/man/tysend.1 --- terminology-1.3.0/man/tysend.1 1970-01-01 00:00:00.000000000 +0000 +++ terminology-1.3.2/man/tysend.1 2018-12-18 20:16:17.000000000 +0000 @@ -0,0 +1 @@ +.so man1/terminology-helpers.1 diff -Nru terminology-1.3.0/meson.build terminology-1.3.2/meson.build --- terminology-1.3.0/meson.build 2018-11-23 18:41:18.000000000 +0000 +++ terminology-1.3.2/meson.build 2018-12-18 20:16:17.000000000 +0000 @@ -1,5 +1,5 @@ project('terminology', 'c', - version: '1.3.0', + version: '1.3.2', default_options: ['c_std=gnu99'], license: 'BSD') diff -Nru terminology-1.3.0/NEWS terminology-1.3.2/NEWS --- terminology-1.3.0/NEWS 2018-11-23 18:41:17.000000000 +0000 +++ terminology-1.3.2/NEWS 2018-12-18 20:16:17.000000000 +0000 @@ -1,7 +1,25 @@ ================= -Terminology 1.3.0 +Terminology 1.3.2 ================= +Changes since 1.3.1: +-------------------- + +Fix: + * Clicking on links works again + + +Changes since 1.3.0: +-------------------- + +Addition: + * Add manpages on Terminology's helpers + +Fixes: + * Do not popup unknown media types (security issue) + * Right-click on hyperlinks no longer crashes + + Changes since 1.2.1: -------------------- diff -Nru terminology-1.3.0/README.md terminology-1.3.2/README.md --- terminology-1.3.0/README.md 2018-11-23 18:41:17.000000000 +0000 +++ terminology-1.3.2/README.md 2018-12-18 20:16:17.000000000 +0000 @@ -1,4 +1,4 @@ -Terminology 1.2.1 +Terminology 1.3.2 ================= This is an EFL terminal emulator with some extra bells and whistles. diff -Nru terminology-1.3.0/src/bin/media.c terminology-1.3.2/src/bin/media.c --- terminology-1.3.0/src/bin/media.c 2018-11-23 18:41:18.000000000 +0000 +++ terminology-1.3.2/src/bin/media.c 2018-12-18 20:16:17.000000000 +0000 @@ -1538,7 +1538,6 @@ const char *cmd; char buf[PATH_MAX]; char *escaped; - cmd = "xdg-open"; escaped = ecore_file_escape_name(src); if (!escaped) @@ -1547,6 +1546,5 @@ cmd = handler; snprintf(buf, sizeof(buf), "%s %s", cmd, escaped); free(escaped); - ecore_exe_run(buf, NULL); } diff -Nru terminology-1.3.0/src/bin/termio.c terminology-1.3.2/src/bin/termio.c --- terminology-1.3.0/src/bin/termio.c 2018-11-23 18:41:18.000000000 +0000 +++ terminology-1.3.2/src/bin/termio.c 2018-12-18 20:16:17.000000000 +0000 @@ -51,7 +51,7 @@ int button; } mouse; struct { - char *string; + const char *string; int x1, y1, x2, y2; int suspend; uint16_t id; @@ -819,12 +819,40 @@ return EINA_TRUE; } -const char * +/* Need to be freed */ +const char * termio_link_get(const Evas_Object *obj) { Termio *sd = evas_object_smart_data_get(obj); EINA_SAFETY_ON_NULL_RETURN_VAL(sd, NULL); - return sd->link.string; + const char *link; + + if (!sd->link.string && !sd->link.id) + return NULL; + link = sd->link.string; + if (sd->link.id) + { + Term_Link *hl = &sd->pty->hl.links[sd->link.id]; + if (!hl->url) + return NULL; + link = hl->url; + } + if (link_is_url(link)) + { + if (casestartswith(link, "file://")) + { + // TODO: decode string: %XX -> char + link = link + sizeof("file://") - 1; + /* Handle cases where / is ommitted: file://HOSTNAME/home/ */ + if (link[0] != '/') + { + link = strchr(link, '/'); + if (!link) + return NULL; + } + } + } + return strdup(link); } static void @@ -834,33 +862,32 @@ Config *config; char buf[PATH_MAX], *s, *escaped; const char *path = NULL, *cmd = NULL; + const char *link = NULL; Eina_Bool url = EINA_FALSE, email = EINA_FALSE, handled = EINA_FALSE; EINA_SAFETY_ON_NULL_RETURN(sd); config = sd->config; if (!config) return; if (!config->active_links) return; - if (!sd->link.string) return; - if (link_is_url(sd->link.string)) - { - if (casestartswith(sd->link.string, "file://")) - // TODO: decode string: %XX -> char - path = sd->link.string + sizeof("file://") - 1; - else - url = EINA_TRUE; - } - else if (sd->link.string[0] == '/') - path = sd->link.string; - else if (link_is_email(sd->link.string)) + + link = termio_link_get(obj); + if (!link) + return; + + if (link_is_url(link)) + url = EINA_TRUE; + else if (link[0] == '/') + path = link; + else if (link_is_email(link)) email = EINA_TRUE; - if (url && casestartswith(sd->link.string, "mailto:")) + if (url && casestartswith(link, "mailto:")) { email = EINA_TRUE; url = EINA_FALSE; } - s = eina_str_escape(sd->link.string); + s = eina_str_escape(link); if (!s) return; if (email) { @@ -888,10 +915,10 @@ // locally accessible file cmd = "xdg-open"; - escaped = ecore_file_escape_name(s); + escaped = ecore_file_escape_name(path); if (escaped) { - Media_Type type = media_src_type_get(sd->link.string); + Media_Type type = media_src_type_get(path); if (may_inline && _should_inline(obj)) { if ((type == MEDIA_TYPE_IMG) || @@ -942,7 +969,7 @@ escaped = ecore_file_escape_name(s); if (escaped) { - Media_Type type = media_src_type_get(sd->link.string); + Media_Type type = media_src_type_get(link); if (may_inline && _should_inline(obj)) { evas_object_smart_callback_call(obj, "popup", NULL); @@ -1050,9 +1077,20 @@ size_t len; EINA_SAFETY_ON_NULL_RETURN(sd); - raw_link = termio_selection_get(term, sd->link.x1, sd->link.y1, sd->link.x2, sd->link.y2, &len, EINA_FALSE); + if (sd->link.id) + { + Term_Link *hl = &sd->pty->hl.links[sd->link.id]; - _take_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, raw_link); + if (!hl->url) + return; + _take_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, hl->url); + } + else + { + raw_link = termio_selection_get(term, sd->link.x1, sd->link.y1, sd->link.x2, sd->link.y2, &len, EINA_FALSE); + + _take_selection_text(sd, ELM_SEL_TYPE_CLIPBOARD, raw_link); + } sd->ctxpopup = NULL; evas_object_del(obj); @@ -1082,6 +1120,16 @@ Evas_Event_Mouse_Down *ev = event; Termio *sd = evas_object_smart_data_get(data); EINA_SAFETY_ON_NULL_RETURN(sd); + Term_Link *hl = NULL; + + + if (!sd->link.string && sd->link.id) + { + hl = &sd->pty->hl.links[sd->link.id]; + if (!hl->url) + return; + sd->link.string = eina_stringshare_add(hl->url); + } if (ev->button == 1) { @@ -1093,7 +1141,7 @@ { Evas_Object *ctxp; Eina_Bool absolut = EINA_FALSE; - char *raw_link; + const char *raw_link; size_t len; if (sd->pty->selection.is_active) @@ -1121,7 +1169,20 @@ } elm_ctxpopup_item_append(ctxp, _("Open"), NULL, _cb_ctxp_link_open, sd->self); - raw_link = termio_selection_get(sd->self, sd->link.x1, sd->link.y1, sd->link.x2, sd->link.y2, &len, EINA_FALSE); + if (hl) + { + raw_link = hl->url; + } + else + { + raw_link = termio_selection_get(sd->self, + sd->link.x1, + sd->link.y1, + sd->link.x2, + sd->link.y2, + &len, + EINA_FALSE); + } if (len > 0 && raw_link[0] == '/') absolut = EINA_TRUE; @@ -1145,7 +1206,8 @@ _cb_ctxp_dismissed, sd); evas_object_event_callback_add(ctxp, EVAS_CALLBACK_DEL, _cb_ctxp_del, sd); - free(raw_link); + if (!hl) + free((void*)raw_link); } } @@ -1257,7 +1319,8 @@ Evas_Coord dx, dy; EINA_SAFETY_ON_NULL_RETURN(sd); - if (!sd->link.down.down) return; + if (!sd->link.down.down) + return; dx = abs(ev->cur.canvas.x - sd->link.down.x); dy = abs(ev->cur.canvas.y - sd->link.down.y); if ((sd->config->drag_links) && @@ -1384,7 +1447,7 @@ if (sd->link.string) { - free(sd->link.string); + eina_stringshare_del(sd->link.string); sd->link.string = NULL; } sd->link.x1 = -1; @@ -2511,7 +2574,7 @@ { Termio *sd = evas_object_smart_data_get(obj); int start_x = 0, start_y = 0, end_x = 0, end_y = 0; - char *s = NULL; + const char *s = NULL; size_t len = 0; EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE); @@ -2533,7 +2596,7 @@ if (sd->link.string) { len = strlen(sd->link.string); - s = strndup(sd->link.string, len); + s = eina_stringshare_add_length(sd->link.string, len); } goto end; } @@ -2560,12 +2623,14 @@ } len = eina_strbuf_length_get(sb); s = eina_strbuf_string_steal(sb); + s = eina_stringshare_add_length(s, len); eina_strbuf_free(sb); } else { s = termio_selection_get(obj, start_x, start_y, end_x, end_y, &len, EINA_TRUE); + s = eina_stringshare_add_length(s, len); } end: @@ -2573,7 +2638,7 @@ { if ((sd->win) && (len > 0)) _take_selection_text(sd, type, s); - free(s); + eina_stringshare_del(s); return EINA_TRUE; } return EINA_FALSE; @@ -3711,7 +3776,8 @@ EINA_SAFETY_ON_NULL_RETURN(sd); config = sd->config; - if (!config->active_links) return; + if (!config->active_links) + return; if ((sd->mouse.cx < 0) || (sd->mouse.cy < 0) || (sd->link.suspend) || (!evas_object_focus_get(obj))) @@ -3741,8 +3807,8 @@ } if (sd->link.string) - free(sd->link.string); - sd->link.string = s; + eina_stringshare_del(sd->link.string); + sd->link.string = eina_stringshare_add(s); if ((x1 == sd->link.x1) && (y1 == sd->link.y1) && (x2 == sd->link.x2) && (y2 == sd->link.y2)) @@ -5531,7 +5597,8 @@ if (sd->mouseover_delay) ecore_timer_del(sd->mouseover_delay); if (sd->font.name) eina_stringshare_del(sd->font.name); if (sd->pty) termpty_free(sd->pty); - if (sd->link.string) free(sd->link.string); + if (sd->link.string) + eina_stringshare_del(sd->link.string); if (sd->glayer) evas_object_del(sd->glayer); if (sd->win) evas_object_event_callback_del_full(sd->win, EVAS_CALLBACK_DEL, diff -Nru terminology-1.3.0/src/bin/win.c terminology-1.3.2/src/bin/win.c --- terminology-1.3.0/src/bin/win.c 2018-11-23 18:41:18.000000000 +0000 +++ terminology-1.3.2/src/bin/win.c 2018-12-18 20:16:17.000000000 +0000 @@ -4058,6 +4058,7 @@ Ecore_Event_Handler *url_complete; Ecore_Timer *timeout; Term *term; + Eina_Bool fallback_allowed; } Ty_Http_Head; static void @@ -4082,8 +4083,12 @@ _media_http_head_timeout(void *data) { Ty_Http_Head *ty_head = data; - media_unknown_handle(ty_head->handler, ty_head->src); + ty_head->timeout = NULL; + if (ty_head->fallback_allowed) + { + media_unknown_handle(ty_head->handler, ty_head->src); + } _ty_http_head_delete(ty_head); return ECORE_CALLBACK_CANCEL; } @@ -4151,14 +4156,17 @@ _ty_http_head_delete(ty_head); return EINA_TRUE; error: - media_unknown_handle(ty_head->handler, ty_head->src); + if (ty_head->fallback_allowed) + { + media_unknown_handle(ty_head->handler, ty_head->src); + } _ty_http_head_delete(ty_head); return EINA_TRUE; } #endif static void -_popmedia(Term *term, const char *src) +_popmedia(Term *term, const char *src, Eina_Bool from_user_interaction) { Media_Type type; Config *config = termio_config_get(term->termio); @@ -4168,22 +4176,34 @@ { #ifdef HAVE_ECORE_CON_URL_HEAD Ty_Http_Head *ty_head = calloc(1, sizeof(Ty_Http_Head)); - if (!ty_head) return; + if (!ty_head) + return; if (config->helper.local.general && config->helper.local.general[0]) { ty_head->handler = eina_stringshare_add(config->helper.local.general); - if (!ty_head->handler) goto error; + if (!ty_head->handler) + goto error; } + /* If it comes from a user interaction (click on a link), allow + * fallback to "xdg-open" + * Otherwise, it's from terminology's escape code. Thus don't allow + * fallback and only display content "inline". + */ + ty_head->fallback_allowed = from_user_interaction; ty_head->src = eina_stringshare_add(src); - if (!ty_head->src) goto error; + if (!ty_head->src) + goto error; ty_head->url = ecore_con_url_new(src); - if (!ty_head->url) goto error; - if (!ecore_con_url_head(ty_head->url)) goto error; + if (!ty_head->url) + goto error; + if (!ecore_con_url_head(ty_head->url)) + goto error; ty_head->url_complete = ecore_event_handler_add (ECORE_CON_EVENT_URL_COMPLETE, _media_http_head_complete, ty_head); ty_head->timeout = ecore_timer_add(2.5, _media_http_head_timeout, ty_head); - if (!ty_head->url_complete) goto error; + if (!ty_head->url_complete) + goto error; ty_head->term = term; edje_object_signal_emit(term->bg, "busy", "terminology"); term_ref(term); @@ -4192,8 +4212,10 @@ error: _ty_http_head_delete(ty_head); #endif - - media_unknown_handle(config->helper.local.general, src); + if (from_user_interaction) + { + media_unknown_handle(config->helper.local.general, src); + } } else { @@ -4371,26 +4393,43 @@ elm_object_focus_set(o, EINA_TRUE); } +struct Pop_Media { + const char *src; + Eina_Bool from_user_interaction; +}; + static void _popmedia_queue_process(Term *term) { - const char *src; + struct Pop_Media *pm; - if (!term->popmedia_queue) return; - src = term->popmedia_queue->data; + if (!term->popmedia_queue) + return; + pm = term->popmedia_queue->data; term->popmedia_queue = eina_list_remove_list(term->popmedia_queue, term->popmedia_queue); - if (!src) return; - _popmedia(term, src); - eina_stringshare_del(src); + if (!pm) + return; + _popmedia(term, pm->src, pm->from_user_interaction); + eina_stringshare_del(pm->src); + free(pm); } static void -_popmedia_queue_add(Term *term, const char *src) +_popmedia_queue_add(Term *term, const char *src, + Eina_Bool from_user_interaction) { - term->popmedia_queue = eina_list_append(term->popmedia_queue, - eina_stringshare_add(src)); - if (!term->popmedia) _popmedia_queue_process(term); + struct Pop_Media *pm = calloc(1, sizeof(struct Pop_Media)); + + if (!pm) + return; + + pm->src = eina_stringshare_add(src); + pm->from_user_interaction = from_user_interaction; + + term->popmedia_queue = eina_list_append(term->popmedia_queue, pm); + if (!term->popmedia) + _popmedia_queue_process(term); } static void @@ -4400,10 +4439,19 @@ { Term *term = data; const char *src = event; + Eina_Bool from_user_interaction = EINA_FALSE; - if (!src) src = termio_link_get(term->termio); - if (!src) return; - _popmedia(term, src); + if (!src) + { + /* Popup a link, there was user interaction on it. */ + from_user_interaction = EINA_TRUE; + src = termio_link_get(term->termio); + } + if (!src) + return; + _popmedia(term, src, from_user_interaction); + if (!event) + free((void*)src); } static void @@ -4413,9 +4461,18 @@ { Term *term = data; const char *src = event; - if (!src) src = termio_link_get(term->termio); - if (!src) return; - _popmedia_queue_add(term, src); + Eina_Bool from_user_interaction = EINA_FALSE; + + if (!src) + { + from_user_interaction = EINA_TRUE; + src = termio_link_get(term->termio); + } + if (!src) + return; + _popmedia_queue_add(term, src, from_user_interaction); + if (!event) + free((void*)src); } static void @@ -4712,11 +4769,11 @@ { if (cmd[1] == 'n') // now { - _popmedia(term, cmd + 2); + _popmedia(term, cmd + 2, EINA_FALSE); } else if (cmd[1] == 'q') // queue it to display after current one { - _popmedia_queue_add(term, cmd + 2); + _popmedia_queue_add(term, cmd + 2, EINA_FALSE); } } else if (cmd[0] == 'b') // set background