Refactored strwidth. - sam - An updated version of the sam text editor. | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 07fee62f4bb6be463c3af403648b53b7b181db92 | |
parent 2c53b3deb305e9b562c5bd39d8b33e94571961c3 | |
Author: Rob King <[email protected]> | |
Date: Tue, 4 Oct 2016 01:45:29 -0500 | |
Refactored strwidth. | |
Diffstat: | |
libXg/string.c | 11 ++++------- | |
samterm/main.c | 7 ++++--- | |
2 files changed, 8 insertions(+), 10 deletions(-) | |
--- | |
diff --git a/libXg/string.c b/libXg/string.c | |
@@ -8,12 +8,9 @@ | |
Point | |
string(Bitmap *b, Point p, XftFont *ft, char *s, Fcode f) | |
{ | |
- size_t length = strlen(s); | |
- XGlyphInfo extents = {0}; | |
- int x = p.x; | |
- int y = p.y; | |
- | |
- XftTextExtentsUtf8(_dpy, ft, (FcChar8 *)s, length, &extents); | |
+ size_t length = strlen(s); | |
+ int x = p.x; | |
+ int y = p.y; | |
x = p.x; | |
y = p.y; | |
@@ -27,7 +24,7 @@ string(Bitmap *b, Point p, XftFont *ft, char *s, Fcode f) | |
b->fd = XftDrawCreate(_dpy, (Drawable)(b->id), DefaultVisual(_dpy, Def… | |
XftDrawStringUtf8(b->fd, &fontcolor, ft, x, y, (FcChar8 *)s, length); | |
- x += extents.xOff; | |
+ x += strwidth(ft, s); | |
p.x = (b->flag & SHIFT) ? x + b->r.min.x : x; | |
p.x = x + b->r.min.x; | |
diff --git a/samterm/main.c b/samterm/main.c | |
@@ -427,9 +427,9 @@ flushtyping(int clearesc) | |
Text *t; | |
uint64_t n; | |
- if(clearesc) | |
+ if (clearesc) | |
typeesc = -1; | |
- if(typestart == typeend) { | |
+ if (typestart == typeend){ | |
modified = false; | |
return; | |
} | |
@@ -767,9 +767,10 @@ int | |
getlayer(const Flayer *l, const Text *t) | |
{ | |
int i; | |
- for (i = 0; i < NL; i++) | |
+ for (i = 0; i < NL; i++){ | |
if (&t->l[i] == l) | |
return i; | |
+ } | |
return -1; | |
} |