[wiki] [sites] [st][selectioncolors] Add setting ignoreselfg || aleks

From: <git_AT_suckless.org>
Date: Thu, 10 Oct 2019 23:34:07 +0200

commit f73e2315bc1aa6576b9c371ffabd850575432018
Author: aleks <aleks.stier_AT_icloud.com>
Date: Thu Oct 10 23:33:28 2019 +0200

    [st][selectioncolors] Add setting ignoreselfg

diff --git a/st.suckless.org/patches/selectioncolors/index.md b/st.suckless.org/patches/selectioncolors/index.md
index d4810a3b..559848e2 100644
--- a/st.suckless.org/patches/selectioncolors/index.md
+++ b/st.suckless.org/patches/selectioncolors/index.md
_AT_@ -4,10 +4,9 @@ selectioncolors
 Description
 -----------
 
-This patch adds the two settings *selectionfg* and *selectionbg* to
-config.def.h. Those define the fore- and background colors which are
-used when text on the screen is selected with the mouse.
-This removes the default behaviour which would simply reverse the colors.
+This patch adds the two color-settings *selectionfg* and *selectionbg* to config.def.h. Those define the fore- and background colors which are used when text on the screen is selected with the mouse. This removes the default behaviour which would simply reverse the colors.
+
+Additionally, a third setting *ingnoreselfg* exists. If true then the setting *selectionfg* is ignored and the original foreground-colors of each cell are not changed during selection. Basically only the background-color would change. This might be more visually appealing to some folks.
 
 Download
 --------
diff --git a/st.suckless.org/patches/selectioncolors/st-selectioncolors-0.8.2.diff b/st.suckless.org/patches/selectioncolors/st-selectioncolors-0.8.2.diff
index 7023f5fb..51ffc3c9 100644
--- a/st.suckless.org/patches/selectioncolors/st-selectioncolors-0.8.2.diff
+++ b/st.suckless.org/patches/selectioncolors/st-selectioncolors-0.8.2.diff
_AT_@ -1,47 +1,65 @@
-From fdbe8cc09d765a1b257aadf0d05ee2cf453d5ffc Mon Sep 17 00:00:00 2001
+From 33bf0cb9ad1f3941ecfd7c9f3902607dcabc6978 Mon Sep 17 00:00:00 2001
 From: aleks <aleks.stier_AT_icloud.com>
-Date: Thu, 10 Oct 2019 12:11:11 +0200
+Date: Thu, 10 Oct 2019 23:22:38 +0200
 Subject: [PATCH] Add settings for selection-colors
 
-This patch adds the two settings selectionfg and selectionbg to
-config.def.h. Those define the fore- and background colors which are
-used when text on the screen is selected with the mouse.
+This patch adds the two color-settings *selectionfg* and *selectionbg* to
+config.def.h. Those define the fore- and background colors which are used when
+text on the screen is selected with the mouse. This removes the default
+behaviour which would simply reverse the colors.
 
-This removes the default behaviour which would simply reverse the colors
-of each selected cell.
+Additionally, a third setting *ingnoreselfg* exists. If true then the setting
+*selectionfg* is ignored and the original foreground-colors of each cell are
+not changed during selection. Basically only the background-color would change.
+This might be more visually appealing to some folks.
 ---
- config.def.h | 4 ++++
- x.c | 5 ++---
- 2 files changed, 6 insertions(+), 3 deletions(-)
+ config.def.h | 11 +++++++++--
+ x.c | 6 +++---
+ 2 files changed, 12 insertions(+), 5 deletions(-)
 
 diff --git a/config.def.h b/config.def.h
-index 0e01717..654b1c7 100644
+index 0e01717..fbbb2a4 100644
 --- a/config.def.h
 +++ b/config.def.h
-_AT_@ -121,6 +121,10 @@ unsigned int defaultbg = 0;
- static unsigned int defaultcs = 256;
- static unsigned int defaultrcs = 257;
+_AT_@ -108,7 +108,7 @@ static const char *colorname[] = {
+
+ /* more colors can be added after 255 to use with DefaultXX */
+ "#cccccc",
+- "#555555",
++ "#2e3440",
+ };
  
+
+_AT_@ -119,7 +119,14 @@ static const char *colorname[] = {
+ unsigned int defaultfg = 7;
+ unsigned int defaultbg = 0;
+ static unsigned int defaultcs = 256;
+-static unsigned int defaultrcs = 257;
++static unsigned int defaultrcs = 256;
++
 +/* Colors used for selection */
++unsigned int selectionbg = 257;
 +unsigned int selectionfg = 7;
-+unsigned int selectionbg = 8;
-+
++/* If 0 use selectionfg as foreground in order to have a uniform foreground-color */
++/* Else if 1 keep original foreground-color of each cell => more colors :) */
++static int ignoreselfg = 1;
+
  /*
   * Default shape of cursor
- * 2: Block ("█")
 diff --git a/x.c b/x.c
-index 0422421..310b99c 100644
+index 0422421..a001f2e 100644
 --- a/x.c
 +++ b/x.c
-_AT_@ -1336,9 +1336,8 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
+_AT_@ -1336,9 +1336,9 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
          }
  
          if (base.mode & ATTR_REVERSE) {
 - temp = fg;
 - fg = bg;
 - bg = temp;
-+ fg = &dc.col[selectionfg];
 + bg = &dc.col[selectionbg];
++ if (!ignoreselfg)
++ fg = &dc.col[selectionfg];
          }
  
          if (base.mode & ATTR_BLINK && win.mode & MODE_BLINK)
Received on Thu Oct 10 2019 - 23:34:07 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 10 2019 - 23:36:29 CEST