selectioncolor patch + configuration changes
ci/woodpecker/tag/woodpecker Pipeline was successful Details

This commit is contained in:
Luca Bilke 2024-01-29 21:22:24 +01:00
parent 5b06085a6a
commit fc3d400a7d
No known key found for this signature in database
GPG Key ID: AD6630D0A1E650AC
4 changed files with 41 additions and 37 deletions

View File

@ -152,7 +152,7 @@ static const char *colorname[] = {
/* more colors can be added after 255 to use with DefaultXX */
"#add8e6", /* 256 -> cursor */
"#555555", /* 257 -> rev cursor*/
"#2e3440" /* 267 -> rev cursor */
"#000000", /* 258 -> bg */
"#e5e5e5", /* 259 -> fg */
};
@ -160,13 +160,18 @@ static const char *colorname[] = {
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
* foreground, background, cursor, reverse cursor, selection
*/
unsigned int defaultbg = 0;
unsigned int bg = 17, bgUnfocused = 16;
unsigned int defaultfg = 259;
unsigned int defaultcs = 256;
unsigned int defaultrcs = 257;
unsigned int defaultrcs = 256;
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;
/*

View File

@ -122,8 +122,8 @@ char *termname = "st-256color";
unsigned int tabspaces = 8;
/* bg opacity */
float alpha = 0.85;
float alphaUnfocused = 0.75;
float alpha = 0.9;
float alphaUnfocused = 0.8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
@ -150,14 +150,14 @@ static const char *colorname[] = {
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
"#c0caf5", /* default cursor colour */
"#1a1b26", /* default inverted cursor colour */
"#c0caf5", /* default foreground colour */
"#1a1b26", /* default background colour */
"#abb7ed", /* unfocused foreground colour */
"#14141a", /* unfocused background colour */
// "#c0caf5", /* default selection foreground colour */
// "#33467C", /* default selection background colour */
"#c0caf5", /* 256 -> default cursor colour */
"#1a1b26", /* 257 -> default inverted cursor colour */
"#c0caf5", /* 258 -> default foreground colour */
"#1a1b26", /* 259 -> default background colour */
"#abb7ed", /* 260 -> unfocused foreground colour */
"#14141a", /* 261 -> unfocused background colour */
"#c0caf5", /* 262 -> default selection foreground colour */
"#33467C", /* 263 -> default selection background colour */
};
@ -165,11 +165,15 @@ static const char *colorname[] = {
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultbg = 0;
unsigned int bg = 259, bgUnfocused = 261;
unsigned int defaultfg = 258;
unsigned int defaultcs = 256;
unsigned int defaultrcs = 257;
unsigned int defaultfg = 258;
unsigned int defaultbg = 0;
unsigned int bg = 259;
unsigned int bgUnfocused = 261;
unsigned int selectionfg = 262;
unsigned int selectionbg = 263;
static int ignoreselfg = 0;
/*

1
st.h
View File

@ -43,6 +43,7 @@ enum glyph_attribute {
ATTR_BOXDRAW = 1 << 11,
ATTR_LIGA = 1 << 12,
ATTR_SIXEL = 1 << 13,
ATTR_SELECTED = 1 << 14,
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
ATTR_DIRTYUNDERLINE = 1 << 15,
};

28
x.c
View File

@ -1567,6 +1567,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
}
}
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;
@ -2006,7 +2012,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int le
/* remove the old cursor */
if (selected(ox, oy))
og.mode ^= ATTR_REVERSE;
og.mode |= ATTR_REVERSE;
/* Redraw the line where cursor was previously.
* It will restore the ligatures broken by the cursor. */
xdrawline(line, 0, oy, len);
@ -2021,25 +2027,13 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int le
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;
}
g.bg = defaultfg;
drawcol = dc.col[defaultrcs];
} else {
if (selected(cx, cy)) {
g.fg = defaultfg;
g.bg = defaultrcs;
}
else {
g.fg = defaultbg;
g.bg = defaultcs;
}
drawcol = dc.col[g.bg];
drawcol = dc.col[defaultcs];
}
/* draw the new one */
@ -2197,7 +2191,7 @@ xdrawline(Line line, int x1, int y1, int x2)
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, dmode);
specs += i;