commit 1f96c60c0e4453fc9c105551d58455936b0784d9
Author: Michael Buch <[email protected]>
Date:   Mon May 14 23:33:31 2018 +0100

    [st][patch][copyurl] Prevent url highlighting from occasional crash after 
resizing terminal. Also fix occasional partial highlighting. Will replace the 
previous patch on the wiki site

diff --git a/st.suckless.org/patches/copyurl/index.md 
b/st.suckless.org/patches/copyurl/index.md
index 86b98602..c26ba4a2 100644
--- a/st.suckless.org/patches/copyurl/index.md
+++ b/st.suckless.org/patches/copyurl/index.md
@@ -22,9 +22,9 @@ Download
  * [st-copyurl-20170802-e2ee5ee.diff](st-copyurl-20170802-e2ee5ee.diff)
  * [st-copyurl-20180418-7e810b5.diff](st-copyurl-20180418-7e810b5.diff)
 
-Following is the first patch that highlights selected urls:
+Following patches also highlight the selected urls:
 
- * [st-copyurl-20180427-70b7059.diff](st-copyurl-20180427-70b7059.diff)
+ * [st-copyurl-20180514-a7bd977.diff](st-copyurl-20180514-a7bd977.diff)
 
 Authors
 -------
diff --git a/st.suckless.org/patches/copyurl/st-copyurl-20180427-70b7059.diff 
b/st.suckless.org/patches/copyurl/st-copyurl-20180514-a7bd977.diff
similarity index 80%
rename from st.suckless.org/patches/copyurl/st-copyurl-20180427-70b7059.diff
rename to st.suckless.org/patches/copyurl/st-copyurl-20180514-a7bd977.diff
index 95dd7905..a79a714c 100644
--- a/st.suckless.org/patches/copyurl/st-copyurl-20180427-70b7059.diff
+++ b/st.suckless.org/patches/copyurl/st-copyurl-20180514-a7bd977.diff
@@ -1,14 +1,15 @@
-From 70b70594bd1e86a5efe83dad66516464ceca8a04 Mon Sep 17 00:00:00 2001
+From a7bd977e7f53d53223dc0a844406ad706d5fb803 Mon Sep 17 00:00:00 2001
 From: Michael Buch <[email protected]>
-Date: Fri, 27 Apr 2018 00:48:03 +0100
-Subject: [PATCH] [st][patch] copyurl patch to highlight selected urls. Simply
- invert terminal default colors when a url is copied to the clipboard.
+Date: Mon, 14 May 2018 23:27:09 +0100
+Subject: [PATCH] [st][patch][copyurl] Prevent url highlighting from occasional
+ crash after resizing terminal. Also fix occasional partial highlighting. Will
+ replace the previous patch on the wiki site
 
 ---
  config.def.h |  1 +
- st.c         | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ st.c         | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  st.h         |  1 +
- 3 files changed, 80 insertions(+)
+ 3 files changed, 83 insertions(+)
 
 diff --git a/config.def.h b/config.def.h
 index 82b1b09..cbe923e 100644
@@ -23,7 +24,7 @@ index 82b1b09..cbe923e 100644
  
  /*
 diff --git a/st.c b/st.c
-index 0628707..f1ac7b6 100644
+index 0628707..afe3d9a 100644
 --- a/st.c
 +++ b/st.c
 @@ -204,6 +204,7 @@ static void tdefutf8(char);
@@ -52,7 +53,7 @@ index 0628707..f1ac7b6 100644
  void
  csihandle(void)
  {
-@@ -2617,3 +2629,69 @@ redraw(void)
+@@ -2617,3 +2629,72 @@ redraw(void)
        tfulldirt();
        draw();
  }
@@ -70,7 +71,9 @@ index 0628707..f1ac7b6 100644
 +              "abcdefghijklmnopqrstuvwxyz"
 +              "0123456789-._~:/?#@!$&'*+,;=%";
 +
-+      tsetcolor( sel.nb.y, sel.ob.x, sel.oe.x - sel.ob.x + 1, defaultfg, 
defaultbg );
++      // remove highlighting from previous selection if any
++      if(sel.ob.x >= 0 && sel.oe.x >= 0)
++              tsetcolor(sel.nb.y, sel.ob.x, sel.oe.x + 1, defaultfg, 
defaultbg);
 +
 +      int i, row, startrow;
 +      char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */
@@ -107,7 +110,8 @@ index 0628707..f1ac7b6 100644
 +                              break;
 +                      }
 +
-+              tsetcolor( row, sel.ob.x, strlen( match ), defaultbg, defaultfg 
);
++              // highlight selection by inverting terminal colors
++              tsetcolor(row, sel.ob.x, sel.ob.x + strlen( match ), defaultbg, 
defaultfg);
 +
 +              /* select and copy */
 +              sel.mode = 1;


Reply via email to