diff options
| author | bakkeby <[email protected]> | 2020-04-16 20:18:13 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-04-16 20:22:23 +0200 |
| commit | ec32a283803def99433eb2e1af172a19217cd9de (patch) | |
| tree | 19f2d035b3c2873535e488f5d8ee9df222f98412 /patch | |
| parent | f9a001dee71ca5ce23282ca7a7d7a677307d41c7 (diff) | |
| download | dwm-flexipatch-ec32a283803def99433eb2e1af172a19217cd9de.tar.gz dwm-flexipatch-ec32a283803def99433eb2e1af172a19217cd9de.zip | |
[dwm][PATCH] statuscolors, fix status text width computation
This is an updated version of the statuscolors patch that fixes the
computation of the text width. The previous version of the patch
inculded all the byte codes that are used to select the color schemes
when computing the width, obaining a width that is larger than the real
width. This patch fixes that by adding up the widths of the individual
chunks, separated by the codes that select the color schemes.
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/include.c | 5 | ||||
| -rw-r--r-- | patch/statuscolors.c | 23 |
2 files changed, 27 insertions, 1 deletions
diff --git a/patch/include.c b/patch/include.c index 72a840c..42b35f4 100644 --- a/patch/include.c +++ b/patch/include.c @@ -110,6 +110,9 @@ #if STACKER_PATCH #include "stacker.c" #endif +#if STATUSCOLORS_PATCH +#include "statuscolors.c" +#endif #if STATUSCMD_PATCH #include "statuscmd.c" #endif @@ -221,4 +224,4 @@ #endif #if TILE_LAYOUT #include "tile.c" -#endif +#endif
\ No newline at end of file diff --git a/patch/statuscolors.c b/patch/statuscolors.c new file mode 100644 index 0000000..2f015ad --- /dev/null +++ b/patch/statuscolors.c @@ -0,0 +1,23 @@ +int +textw_wosc(char *s) +{ + char *ts = s; + char *tp = s; + int sw = 0; + char ctmp; + while (1) { + if ((unsigned int)*ts > LENGTH(colors)) { + ts++; + continue; + } + ctmp = *ts; + *ts = '\0'; + sw += drw_fontset_getwidth(drw, tp); + *ts = ctmp; + if (ctmp == '\0') + break; + tp = ++ts; + } + + return sw; +}
\ No newline at end of file |
