diff --git a/less-590-hyperlink-bleed.patch b/less-590-hyperlink-bleed.patch new file mode 100644 index 0000000..96a6b34 --- /dev/null +++ b/less-590-hyperlink-bleed.patch @@ -0,0 +1,77 @@ +From a99bf3bf475057a2562bf89860c60b0c2a000d4a Mon Sep 17 00:00:00 2001 +From: "FeRD (Frank Dana)" +Date: Fri, 22 Oct 2021 14:22:23 -0400 +Subject: [PATCH] Backport of 089d6651 to less 590 + +--- + line.c | 24 ++++++++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) + +diff --git a/line.c b/line.c +index b8f609e..a587f71 100644 +--- a/line.c ++++ b/line.c +@@ -38,6 +38,7 @@ struct xbuffer last_ansi; + + public int size_linebuf = 0; /* Size of line buffer (and attr buffer) */ + static struct ansi_state *line_ansi = NULL; ++static int hlink_in_line; + static int cshift; /* Current left-shift of output line buffer */ + public int hshift; /* Desired left-shift of output line buffer */ + public int tabstops[TABSTOP_MAX] = { 0 }; /* Custom tabstops */ +@@ -221,6 +222,7 @@ prewind(VOID_PARAM) + is_null_line = 0; + pendc = '\0'; + in_hilite = 0; ++ hlink_in_line = 0; + xbuf_reset(&shifted_ansi); + xbuf_reset(&last_ansi); + } +@@ -251,6 +253,19 @@ add_linebuf(ch, attr, w) + inc_end_column(w); + } + ++/* ++ * Append a string to the line buffer. ++ */ ++ static void ++addstr_linebuf(s, attr, cw) ++ char *s; ++ int attr; ++ int cw; ++{ ++ for ( ; *s != '\0'; s++) ++ add_linebuf(*s, attr, cw); ++} ++ + /* + * Set a character in the line prefix buffer. + */ +@@ -958,6 +973,8 @@ store_ansi(ch, rep, pos) + case ANSI_MID: + if (!in_hilite) + STORE_CHAR(ch, AT_ANSI, rep, pos); ++ if (line_ansi->hlink) ++ hlink_in_line = 1; + break; + case ANSI_END: + if (!in_hilite) +@@ -1138,12 +1155,11 @@ pflushmbc(VOID_PARAM) + static void + add_attr_normal(VOID_PARAM) + { +- char *p = "\033[m"; +- + if (ctldisp != OPT_ONPLUS || !is_ansi_end('m')) + return; +- for ( ; *p != '\0'; p++) +- add_linebuf(*p, AT_ANSI, 0); ++ addstr_linebuf("\033[m", AT_ANSI, 0); ++ if (hlink_in_line) /* Don't send hyperlink clear if we know we don't need to. */ ++ addstr_linebuf("\033]8;;\033\\", AT_ANSI, 0); + } + + /* +-- +2.31.1 + diff --git a/less.spec b/less.spec index 208b57d..fa54369 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 590 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ or BSD Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -15,6 +15,9 @@ Patch8: less-458-lessecho-usage.patch Patch9: less-458-less-filters-man.patch Patch10: less-458-lesskey-usage.patch Patch11: less-458-old-bot-in-help.patch +# Backported version of upstream commit d21820c +# https://github.com/gwsw/less/commit/d21820c9d8501b5814d33d4fb8a621c6c563e102 +Patch12: less-590-hyperlink-bleed.patch URL: https://www.greenwoodsoftware.com/less/ BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool @@ -40,6 +43,7 @@ files, and you'll use it frequently. %patch9 -p1 -b .less-filters-man %patch10 -p1 -b .lesskey-usage %patch11 -p1 -b .old-bot +%patch12 -p1 -b .hyperlinks %build @@ -63,6 +67,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Sat Oct 02 2021 FeRD (Frank Dana) - 590-2 +- Backport patch from upstream to fix hyperlinked text bug + * Tue Aug 10 2021 Matej Mužila - 590-1 - Update to new upstream release