diff options
author | Marvin Borner | 2020-07-05 15:53:23 +0200 |
---|---|---|
committer | Marvin Borner | 2020-07-05 15:53:23 +0200 |
commit | 888dd53bdba27f799d401d36b34e4e41d7c468fc (patch) | |
tree | a77c350d6444df08e1863da14684f17641c0cb62 | |
parent | a738067f158938d9db8ef4e9be71804a2a6ef7c2 (diff) |
Some changes
-rw-r--r-- | .bashrc | 1 | ||||
-rw-r--r-- | .config/nvim/init.vim | 3 | ||||
-rw-r--r-- | .repos/st/FUNDING.yml | 5 | ||||
-rw-r--r-- | .repos/st/st.h | 6 | ||||
-rw-r--r-- | .repos/st/x.c | 136 | ||||
-rwxr-xr-x | .scripts/commstat | 1 | ||||
-rwxr-xr-x | .scripts/compile | 5 | ||||
-rw-r--r-- | packages.txt | 1 |
8 files changed, 88 insertions, 70 deletions
@@ -34,6 +34,7 @@ alias clip='xclip -selection c' alias scrot='maim -us | clip -t image/png' alias py='python3' alias js='node' +alias prev='preview' alias script='script -q' alias sudo='sudo ' alias please='sudo $(fc -ln -1)' diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 84a6e22..e50fb51 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -166,8 +166,7 @@ autocmd TermOpen * startinsert nmap <Leader>a :!echo <c-r>% \| entr compile <c-r>% &<CR><CR> nmap <Leader>c :w! \| !compile <c-r>%<CR> nmap <Leader>p :!preview <c-r>%<CR><CR> -nmap <Leader>r :w! \| !./run<CR> -nmap <Leader>R :w! \| terminal<CR>./run<CR> +nmap <Leader>r :w! \| terminal<CR>./run<CR> " FZF nmap ; :Files<CR> diff --git a/.repos/st/FUNDING.yml b/.repos/st/FUNDING.yml new file mode 100644 index 0000000..5b856dc --- /dev/null +++ b/.repos/st/FUNDING.yml @@ -0,0 +1,5 @@ +github: lukesmithxyz +custom: "https://lukesmith.xyz/donate" +custom: "https://paypal.me/lukemsmith" +patreon: lukesmith +custom: "https://lukesmith.xyz/crypto" diff --git a/.repos/st/st.h b/.repos/st/st.h index 33cc5d4..b85474b 100644 --- a/.repos/st/st.h +++ b/.repos/st/st.h @@ -37,6 +37,12 @@ enum glyph_attribute { ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, }; +enum drawing_mode { + DRAW_NONE = 0, + DRAW_BG = 1 << 0, + DRAW_FG = 1 << 1, +}; + enum selection_mode { SEL_IDLE = 0, SEL_EMPTY = 1, diff --git a/.repos/st/x.c b/.repos/st/x.c index 55f4a61..c1f050b 100644 --- a/.repos/st/x.c +++ b/.repos/st/x.c @@ -152,7 +152,7 @@ typedef struct { static inline ushort sixd_to_16bit(int); static int xmakeglyphfontspecs(XftGlyphFontSpec *, const Glyph *, int, int, int); -static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int); +static void xdrawglyphfontspecs(const XftGlyphFontSpec *, Glyph, int, int, int, int); static void xdrawglyph(Glyph, int, int); static void xclear(int, int, int, int); static int xgeommasktogravity(int); @@ -1445,14 +1445,13 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x } void -xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y) +xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y, int dmode) { int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1); int winx = win.hborderpx + x * win.cw, winy = win.vborderpx + y * win.ch, width = charlen * win.cw; Color *fg, *bg, *temp, revfg, revbg, truefg, truebg; XRenderColor colfg, colbg; - XRectangle r; /* Fallback on color display for attributes not supported by the font */ if (base.mode & ATTR_ITALIC && base.mode & ATTR_BOLD) { @@ -1532,51 +1531,45 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i if (base.mode & ATTR_INVISIBLE) fg = bg; - /* Intelligent cleaning up of the borders. */ - if (x == 0) { - xclear(0, (y == 0)? 0 : winy, win.vborderpx, - winy + win.ch + - ((winy + win.ch >= win.vborderpx + win.th)? win.h : 0)); - } - if (winx + width >= win.hborderpx + win.tw) { - xclear(winx + width, (y == 0)? 0 : winy, win.w, - ((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch))); - } - if (y == 0) - xclear(winx, 0, winx + width, win.hborderpx); - if (winy + win.ch >= win.vborderpx + win.th) - xclear(winx, winy + win.ch, winx + width, win.h); - - /* Clean up the region we want to draw to. */ - XftDrawRect(xw.draw, bg, winx, winy, width, win.ch); - - /* Set the clip region because Xft is sometimes dirty. */ - r.x = 0; - r.y = 0; - r.height = win.ch; - r.width = width; - XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1); - - if (base.mode & ATTR_BOXDRAW) { - drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len); - } else { - /* Render the glyphs. */ - XftDrawGlyphFontSpec(xw.draw, fg, specs, len); - } + if (dmode & DRAW_BG) { + /* Intelligent cleaning up of the borders. */ + if (x == 0) { + xclear(0, (y == 0)? 0 : winy, win.vborderpx, + winy + win.ch + + ((winy + win.ch >= win.vborderpx + win.th)? win.h : 0)); + } + if (winx + width >= win.hborderpx + win.tw) { + xclear(winx + width, (y == 0)? 0 : winy, win.w, + ((winy + win.ch >= win.vborderpx + win.th)? win.h : (winy + win.ch))); + } + if (y == 0) + xclear(winx, 0, winx + width, win.hborderpx); + if (winy + win.ch >= win.vborderpx + win.th) + xclear(winx, winy + win.ch, winx + width, win.h); - /* Render underline and strikethrough. */ - if (base.mode & ATTR_UNDERLINE) { - XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent + 1, - width, 1); + /* Fill the background */ + XftDrawRect(xw.draw, bg, winx, winy, width, win.ch); } - if (base.mode & ATTR_STRUCK) { - XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent / 3, - width, 1); - } + if (dmode & DRAW_FG) { + if (base.mode & ATTR_BOXDRAW) { + drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len); + } else { + /* Render the glyphs. */ + XftDrawGlyphFontSpec(xw.draw, fg, specs, len); + } + + /* Render underline and strikethrough. */ + if (base.mode & ATTR_UNDERLINE) { + XftDrawRect(xw.draw, fg, winx, winy + win.cyo + dc.font.ascent + 1, + width, 1); + } - /* Reset clip to none. */ - XftDrawSetClip(xw.draw, 0); + if (base.mode & ATTR_STRUCK) { + XftDrawRect(xw.draw, fg, winx, winy + win.cyo + 2 * dc.font.ascent / 3, + width, 1); + } + } } void @@ -1586,7 +1579,7 @@ xdrawglyph(Glyph g, int x, int y) XftGlyphFontSpec spec; numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y); - xdrawglyphfontspecs(&spec, g, numspecs, x, y); + xdrawglyphfontspecs(&spec, g, numspecs, x, y, DRAW_BG | DRAW_FG); } void @@ -1705,32 +1698,39 @@ xstartdraw(void) void xdrawline(Line line, int x1, int y1, int x2) { - int i, x, ox, numspecs; + int i, x, ox, numspecs, numspecs_cached; Glyph base, new; - XftGlyphFontSpec *specs = xw.specbuf; - - numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1); - i = ox = 0; - for (x = x1; x < x2 && i < numspecs; x++) { - new = line[x]; - if (new.mode == ATTR_WDUMMY) - continue; - if (selected(x, y1)) - new.mode ^= ATTR_REVERSE; - if (i > 0 && ATTRCMP(base, new)) { - xdrawglyphfontspecs(specs, base, i, ox, y1); - specs += i; - numspecs -= i; - i = 0; - } - if (i == 0) { - ox = x; - base = new; + XftGlyphFontSpec *specs; + + numspecs_cached = xmakeglyphfontspecs(xw.specbuf, &line[x1], x2 - x1, x1, y1); + + /* Draw line in 2 passes: background and foreground. This way wide glyphs + won't get truncated (#223) */ + for (int dmode = DRAW_BG; dmode <= DRAW_FG; dmode <<= 1) { + specs = xw.specbuf; + numspecs = numspecs_cached; + i = ox = 0; + for (x = x1; x < x2 && i < numspecs; x++) { + new = line[x]; + if (new.mode == ATTR_WDUMMY) + continue; + if (selected(x, y1)) + new.mode ^= ATTR_REVERSE; + if (i > 0 && ATTRCMP(base, new)) { + xdrawglyphfontspecs(specs, base, i, ox, y1, dmode); + specs += i; + numspecs -= i; + i = 0; + } + if (i == 0) { + ox = x; + base = new; + } + i++; } - i++; + if (i > 0) + xdrawglyphfontspecs(specs, base, i, ox, y1, dmode); } - if (i > 0) - xdrawglyphfontspecs(specs, base, i, ox, y1); } void diff --git a/.scripts/commstat b/.scripts/commstat new file mode 100755 index 0000000..f1f641a --- /dev/null +++ b/.scripts/commstat @@ -0,0 +1 @@ +#!/usr/bin/env bash diff --git a/.scripts/compile b/.scripts/compile index ce60741..38295e2 100755 --- a/.scripts/compile +++ b/.scripts/compile @@ -5,6 +5,11 @@ dir=${file%/*} base="${file%.*}" ext="${file##*.}" +if [ -f "$dir/run" ]; then + echo "Using run file" + exec "$dir/run" +fi + case "$ext" in ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf >"$base".pdf ;; [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf >"$base".pdf ;; diff --git a/packages.txt b/packages.txt index e97e26d..1d1e0b8 100644 --- a/packages.txt +++ b/packages.txt @@ -231,6 +231,7 @@ thunderbird-i18n-de thunderbird-i18n-en-us tk tmate +torbrowser-launcher transmission-gtk ttf-dejavu ttf-inconsolata |