JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Remove unused dump() function.
[st.git] / st.c
diff --git a/st.c b/st.c
index bd0c59e..4c4a0c3 100644 (file)
--- a/st.c
+++ b/st.c
@@ -449,6 +449,8 @@ static char *getsel(void);
 static void selcopy(void);
 static void selscroll(int, int);
 static void selsnap(int, int *, int *, int);
+static void getbuttoninfo(XEvent *);
+static void mousereport(XEvent *);
 
 static size_t utf8decode(char *, long *, size_t);
 static long utf8decodebyte(char, size_t *);
@@ -462,6 +464,8 @@ static void *xmalloc(size_t);
 static void *xrealloc(void *, size_t);
 static char *xstrdup(char *);
 
+static void usage(void);
+
 static void (*handler[LASTEvent])(XEvent *) = {
        [KeyPress] = kpress,
        [ClientMessage] = cmessage,
@@ -1238,15 +1242,6 @@ ttynew(void) {
 }
 
 void
-dump(char c) {
-       static int col;
-
-       fprintf(stderr, " %02x '%c' ", c, isprint(c)?c:'.');
-       if(++col % 10 == 0)
-               fprintf(stderr, "\n");
-}
-
-void
 ttyread(void) {
        static char buf[BUFSIZ];
        static int buflen = 0;
@@ -2445,6 +2440,7 @@ tputc(char *c, int len) {
        bool control;
        long unicodep;
        int width;
+       Glyph *gp;
 
        if(len == 1) {
                width = 1;
@@ -2607,16 +2603,15 @@ tputc(char *c, int len) {
                return;
        if(sel.ob.x != -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y))
                selclear(NULL);
+
+       gp = &term.line[term.c.y][term.c.x];
        if(IS_SET(MODE_WRAP) && (term.c.state & CURSOR_WRAPNEXT)) {
-               term.line[term.c.y][term.c.x].mode |= ATTR_WRAP;
+               gp->mode |= ATTR_WRAP;
                tnewline(1);
        }
 
-       if(IS_SET(MODE_INSERT) && term.c.x+1 < term.col) {
-               memmove(&term.line[term.c.y][term.c.x+1],
-                       &term.line[term.c.y][term.c.x],
-                       (term.col - term.c.x - 1) * sizeof(Glyph));
-       }
+       if(IS_SET(MODE_INSERT) && term.c.x+1 < term.col)
+               memmove(gp+1, gp, (term.col - term.c.x - 1) * sizeof(Glyph));
 
        if(term.c.x+width > term.col)
                tnewline(1);
@@ -2624,10 +2619,10 @@ tputc(char *c, int len) {
        tsetchar(c, &term.c.attr, term.c.x, term.c.y);
 
        if(width == 2) {
-               term.line[term.c.y][term.c.x].mode |= ATTR_WIDE;
+               gp->mode |= ATTR_WIDE;
                if(term.c.x+1 < term.col) {
-                       term.line[term.c.y][term.c.x+1].c[0] = '\0';
-                       term.line[term.c.y][term.c.x+1].mode = ATTR_WDUMMY;
+                       gp[1].c[0] = '\0';
+                       gp[1].mode = ATTR_WDUMMY;
                }
        }
        if(term.c.x+width < term.col) {
@@ -3491,12 +3486,9 @@ drawregion(int x1, int y1, int x2, int y2) {
        int ic, ib, x, y, ox, sl;
        Glyph base, new;
        char buf[DRAW_BUF_SIZ];
-       bool ena_sel = sel.ob.x != -1;
+       bool ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN);
        long unicodep;
 
-       if(sel.alt != IS_SET(MODE_ALTSCREEN))
-               ena_sel = 0;
-
        if(!(xw.state & WIN_VISIBLE))
                return;
 
@@ -3573,7 +3565,7 @@ void
 xseturgency(int add) {
        XWMHints *h = XGetWMHints(xw.dpy, xw.win);
 
-       h->flags = add ? (h->flags | XUrgencyHint) : (h->flags & ~XUrgencyHint);
+       MODBIT(h->flags, add, XUrgencyHint);
        XSetWMHints(xw.dpy, xw.win, h);
        XFree(h);
 }