[wiki] [sites] [st][patch][selectioncolors] don't disable color reversing for external programs || Ashish Kumar Yadav
commit db9e7a88a8626f52c43d3e9968507c4a3c8f6d48
Author: Ashish Kumar Yadav <ashishkumar.yadav_AT_students.iiserpune.ac.in>
Date: Mon Jul 20 13:21:12 2020 +0530
[st][patch][selectioncolors] don't disable color reversing for external programs
diff --git a/st.suckless.org/patches/selectioncolors/index.md b/st.suckless.org/patches/selectioncolors/index.md
index 559848e2..1952729c 100644
--- a/st.suckless.org/patches/selectioncolors/index.md
+++ b/st.suckless.org/patches/selectioncolors/index.md
_AT_@ -4,14 +4,23 @@ selectioncolors
Description
-----------
-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 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.
+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
--------
+* [st-selectioncolors-0.8.4.diff](st-selectioncolors-0.8.4.diff)
* [st-selectioncolors-0.8.2.diff](st-selectioncolors-0.8.2.diff)
Authors
-------
* Aleksandrs Stier
+* Ashish Kumar Yadav - <ashishkumar.yadav_AT_students.iiserpune.ac.in> (0.8.4,
+ don't disable color reversing for external programs)
diff --git a/st.suckless.org/patches/selectioncolors/st-selectioncolors-0.8.4.diff b/st.suckless.org/patches/selectioncolors/st-selectioncolors-0.8.4.diff
new file mode 100644
index 00000000..02b38c03
--- /dev/null
+++ b/st.suckless.org/patches/selectioncolors/st-selectioncolors-0.8.4.diff
_AT_@ -0,0 +1,99 @@
+diff -up st-0.8.4-ori/config.def.h st-0.8.4/config.def.h
+--- st-0.8.4-ori/config.def.h 2020-06-19 14:59:45.000000000 +0530
++++ st-0.8.4/config.def.h 2020-07-20 12:28:45.478010118 +0530
+_AT_@ -119,7 +119,7 @@ static const char *colorname[] = {
+
+ /* more colors can be added after 255 to use with DefaultXX */
+ "#cccccc",
+- "#555555",
++ "#2e3440",
+ };
+
+
+_AT_@ -130,7 +130,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;
++/* 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
+diff -up st-0.8.4-ori/st.h st-0.8.4/st.h
+--- st-0.8.4-ori/st.h 2020-06-19 14:59:45.000000000 +0530
++++ st-0.8.4/st.h 2020-07-20 12:29:40.407540957 +0530
+_AT_@ -33,6 +33,7 @@ enum glyph_attribute {
+ ATTR_WRAP = 1 << 8,
+ ATTR_WIDE = 1 << 9,
+ ATTR_WDUMMY = 1 << 10,
++ ATTR_SELECTED = 1 << 11,
+ ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
+ };
+
+diff -up st-0.8.4-ori/x.c st-0.8.4/x.c
+--- st-0.8.4-ori/x.c 2020-06-19 14:59:45.000000000 +0530
++++ st-0.8.4/x.c 2020-07-20 12:52:57.571463683 +0530
+_AT_@ -1425,6 +1425,12 @@ xdrawglyphfontspecs(const XftGlyphFontSp
+ bg = temp;
+ }
+
++ if (base.mode & ATTR_SELECTED) {
++ bg = &dc.col[selectionbg];
++ if (!ignoreselfg)
++ fg = &dc.col[selectionfg];
++ }
++
+ if (base.mode & ATTR_BLINK && win.mode & MODE_BLINK)
+ fg = bg;
+
+_AT_@ -1490,8 +1496,6 @@ xdrawcursor(int cx, int cy, Glyph g, int
+ Color drawcol;
+
+ /* remove the old cursor */
+- if (selected(ox, oy))
+- og.mode ^= ATTR_REVERSE;
+ xdrawglyph(og, ox, oy);
+
+ if (IS_SET(MODE_HIDE))
+_AT_@ -1505,21 +1509,11 @@ xdrawcursor(int cx, int cy, Glyph g, int
+ if (IS_SET(MODE_REVERSE)) {
+ g.mode |= ATTR_REVERSE;
+ g.bg = defaultfg;
+- if (selected(cx, cy)) {
+- drawcol = dc.col[defaultcs];
+- g.fg = defaultrcs;
+- } else {
+- drawcol = dc.col[defaultrcs];
+- g.fg = defaultcs;
+- }
++ drawcol = dc.col[defaultrcs];
++ g.fg = defaultcs;
+ } else {
+- if (selected(cx, cy)) {
+- g.fg = defaultfg;
+- g.bg = defaultrcs;
+- } else {
+- g.fg = defaultbg;
+- g.bg = defaultcs;
+- }
++ g.fg = defaultbg;
++ g.bg = defaultcs;
+ drawcol = dc.col[g.bg];
+ }
+
+_AT_@ -1612,7 +1606,7 @@ xdrawline(Line line, int x1, int y1, int
+ if (new.mode == ATTR_WDUMMY)
+ continue;
+ if (selected(x, y1))
+- new.mode ^= ATTR_REVERSE;
++ new.mode ^= ATTR_SELECTED;
+ if (i > 0 && ATTRCMP(base, new)) {
+ xdrawglyphfontspecs(specs, base, i, ox, y1);
+ specs += i;
Received on Mon Jul 20 2020 - 09:51:26 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 20 2020 - 10:00:49 CEST