sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit dd6f420f7ac13c4ab155d23e21aab2a7d3010bf6
parent f6321df80b8cf51ee83d3032070716d4fe71a781
Author: Kipras Melnikovas <kipras@kipras.org>
Date:   Wed, 24 Feb 2021 04:10:14 +0200

[st][patch] create cursor-color patch

as outlines in the markdown file -- still needs improvements,
and I'm not sure if I have experise to solve them -
I'd appreciate your help!

Signed-off-by: Kipras Melnikovas <kipras@kipras.org>

Diffstat:
Ast.suckless.org/patches/cursor-color/cursor-color.png | 0
Ast.suckless.org/patches/cursor-color/index.md | 26++++++++++++++++++++++++++
Ast.suckless.org/patches/cursor-color/st-cursor-color-0.8.4.diff | 49+++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/st.suckless.org/patches/cursor-color/cursor-color.png b/st.suckless.org/patches/cursor-color/cursor-color.png Binary files differ. diff --git a/st.suckless.org/patches/cursor-color/index.md b/st.suckless.org/patches/cursor-color/index.md @@ -0,0 +1,26 @@ +color-cursor +============ + +![](cursor-color.png) + +Description +----------- +Turns your cursor's background into whatever color the character you're currently on is (much like alacritty). Some say the effeect is very appealing:) + +Notes +----- + +~~Might be~~ Is incomplete - I'm new and suggestions are very welcome! + +- Default cursor is not shown (e.g. in (neo)vim INSERT mode) +- Probably not all cases yet covered +- Magic numbers used - would probably be best to avoid +- Performance degradation considerations? + +Download +-------- +* [st-cursor-color-0.8.4.diff](st-cursor-color-0.8.4.diff) + +Authors +------- +* Kipras Melnikovas <kipras@kipras.org> diff --git a/st.suckless.org/patches/cursor-color/st-cursor-color-0.8.4.diff b/st.suckless.org/patches/cursor-color/st-cursor-color-0.8.4.diff @@ -0,0 +1,49 @@ +From 8cda64fed0308533a1e79da9f5bdf2593d25c885 Mon Sep 17 00:00:00 2001 +From: Kipras Melnikovas <kipras@kipras.org> +Date: Wed, 24 Feb 2021 03:54:42 +0200 +Subject: [PATCH] create initial color-version patch + +swaps cursor background with the character you're currently on, +much like alacritty. + +still needs improvements + +Signed-off-by: Kipras Melnikovas <kipras@kipras.org> +--- + x.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/x.c b/x.c +index 120e495..5a013f8 100644 +--- a/x.c ++++ b/x.c +@@ -1517,11 +1517,24 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og) + if (selected(cx, cy)) { + g.fg = defaultfg; + g.bg = defaultrcs; ++ drawcol = dc.col[g.bg]; + } else { ++ /** swap background, much like alacritty */ ++ g.bg = g.fg; + g.fg = defaultbg; +- g.bg = defaultcs; ++ ++ /** ++ * There were times when the `g.fg` value (now updated to `g.bg) ++ * would jump to a very large one and opening e.g. neovim ++ * would cause a segfault, thus I'm arbitrarily picking this value ++ * and it seems to work, but it'd best if this was improved. ++ */ ++ if (g.bg > 259) { ++ drawcol = dc.col[g.fg]; ++ } else { ++ drawcol = dc.col[g.bg]; ++ } + } +- drawcol = dc.col[g.bg]; + } + + /* draw the new one */ +-- +2.30.1 +