JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Making the selection work again.
[st.git] / st.c
diff --git a/st.c b/st.c
index a2f4f46..a4575f4 100644 (file)
--- a/st.c
+++ b/st.c
@@ -551,7 +551,6 @@ bpress(XEvent *e) {
                sel.mode = 1;
                sel.ex = sel.bx = X2COL(e->xbutton.x);
                sel.ey = sel.by = Y2ROW(e->xbutton.y);
-               draw();
        }
 }
 
@@ -801,9 +800,15 @@ ttynew(void) {
                close(s);
                cmdfd = m;
                signal(SIGCHLD, sigchld);
-               if(opt_io && !(fileio = fopen(opt_io, "w"))) {
-                       fprintf(stderr, "Error opening %s:%s\n",
-                               opt_io, strerror(errno));
+               if(opt_io) {
+                       if(!strcmp(opt_io, "-")) {
+                               fileio = stdout;
+                       } else {
+                               if(!(fileio = fopen(opt_io, "w"))) {
+                                       fprintf(stderr, "Error opening %s:%s\n",
+                                               opt_io, strerror(errno));
+                               }
+                       }
                }
        }
 }
@@ -1127,7 +1132,8 @@ tsetattr(int *attr, int l) {
        for(i = 0; i < l; i++) {
                switch(attr[i]) {
                case 0:
-                       term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE | ATTR_BOLD);
+                       term.c.attr.mode &= ~(ATTR_REVERSE | ATTR_UNDERLINE | ATTR_BOLD \
+                                       | ATTR_ITALIC);
                        term.c.attr.fg = DefaultFG;
                        term.c.attr.bg = DefaultBG;
                        break;
@@ -1565,8 +1571,10 @@ void
 tputc(char *c) {
        char ascii = *c;
 
-       if(fileio)
+       if(fileio) {
                putc(ascii, fileio);
+               fflush(fileio);
+       }
 
        if(term.esc & ESC_START) {
                if(term.esc & ESC_CSI) {
@@ -1960,8 +1968,7 @@ xinit(void) {
        attrs.bit_gravity = NorthWestGravity;
        attrs.event_mask = FocusChangeMask | KeyPressMask
                | ExposureMask | VisibilityChangeMask | StructureNotifyMask
-               | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask
-               | EnterWindowMask | LeaveWindowMask;
+               | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
        attrs.colormap = xw.cmap;
 
        parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr);
@@ -2047,7 +2054,6 @@ void
 xcopy() {
        XdbeSwapInfo swpinfo[1] = {{xw.win, XdbeCopied}};
        XdbeSwapBuffers(xw.dpy, swpinfo, 1);
-
 }
 
 void