Refactored strwidth. - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 07fee62f4bb6be463c3af403648b53b7b181db92
 (DIR) parent 2c53b3deb305e9b562c5bd39d8b33e94571961c3
 (HTM) Author: Rob King <jking@deadpixi.com>
       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(-)
       ---
 (DIR) 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, DefaultScreen(_dpy)), DefaultColormap(_dpy, DefaultScreen(_dpy)));
            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;
 (DIR) 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;
        }