commit f284393b0c4215abfbf7604bf900af4f5d359edb
Author: Miles Alan <[email protected]>
Date:   Sat Jul 4 11:56:04 2020 -0500

    [dmenu][patch] highlight: Modify to only render highlights in width bounds
    
    This prevents unecessary rendering and improves compatibility with the
    grid patch.

diff --git 
a/tools.suckless.org/dmenu/patches/highlight/dmenu-highlight-4.9.diff 
b/tools.suckless.org/dmenu/patches/highlight/dmenu-highlight-4.9.diff
index 04897ea7..8eb784b0 100644
--- a/tools.suckless.org/dmenu/patches/highlight/dmenu-highlight-4.9.diff
+++ b/tools.suckless.org/dmenu/patches/highlight/dmenu-highlight-4.9.diff
@@ -1,12 +1,12 @@
-From 16abaf4bbea01234abab27fbfdfc921aad2fc364 Mon Sep 17 00:00:00 2001
+From a06d0d3d7bbb3c0f5bad44934dbbf1e88e7d9558 Mon Sep 17 00:00:00 2001
 From: Miles Alan <[email protected]>
-Date: Tue, 14 Jan 2020 21:50:04 -0600
+Date: Sat, 4 Jul 2020 11:49:04 -0500
 Subject: [PATCH] Highlight matched text in a different color scheme
 
 ---
  config.def.h |  2 ++
- dmenu.c      | 42 ++++++++++++++++++++++++++++++++++++++++--
- 2 files changed, 42 insertions(+), 2 deletions(-)
+ dmenu.c      | 43 +++++++++++++++++++++++++++++++++++++++++--
+ 2 files changed, 43 insertions(+), 2 deletions(-)
 
 diff --git a/config.def.h b/config.def.h
 index 1edb647..64eab2a 100644
@@ -22,7 +22,7 @@ index 1edb647..64eab2a 100644
  };
  /* -l option; if nonzero, dmenu uses vertical list with given number of lines 
*/
 diff --git a/dmenu.c b/dmenu.c
-index 6b8f51b..c82bb6d 100644
+index 6b8f51b..d5e1991 100644
 --- a/dmenu.c
 +++ b/dmenu.c
 @@ -26,7 +26,7 @@
@@ -34,7 +34,7 @@ index 6b8f51b..c82bb6d 100644
  
  struct item {
        char *text;
-@@ -113,6 +113,42 @@ cistrstr(const char *s, const char *sub)
+@@ -113,6 +113,43 @@ cistrstr(const char *s, const char *sub)
        return NULL;
  }
  
@@ -59,13 +59,14 @@ index 6b8f51b..c82bb6d 100644
 +                      // Move highlight str end, draw highlight, & restore
 +                      restorechar = highlight[strlen(token)];
 +                      highlight[strlen(token)] = '-+                  
drw_text(
-+                              drw,
-+                              x + indentx - (lrpad / 2) - 1,
-+                              y,
-+                              MIN(maxw - indentx, TEXTW(highlight) - lrpad),
-+                              bh, 0, highlight, 0
-+                      );
++                      if (indentx - (lrpad / 2) - 1 < maxw)
++                              drw_text(
++                                      drw,
++                                      x + indentx - (lrpad / 2) - 1,
++                                      y,
++                                      MIN(maxw - indentx, TEXTW(highlight) - 
lrpad),
++                                      bh, 0, highlight, 0
++                              );
 +                      highlight[strlen(token)] = restorechar;
 +
 +                      if (strlen(highlight) - strlen(token) < strlen(token)) 
break;
@@ -77,7 +78,7 @@ index 6b8f51b..c82bb6d 100644
  static int
  drawitem(struct item *item, int x, int y, int w)
  {
-@@ -123,7 +159,9 @@ drawitem(struct item *item, int x, int y, int w)
+@@ -123,7 +160,9 @@ drawitem(struct item *item, int x, int y, int w)
        else
                drw_setscheme(drw, scheme[SchemeNorm]);
  


Reply via email to