X-Git-Url: https://git.xinqibao.xyz/st.git/blobdiff_plain/160bda1b60148ce8f7d3b001ada2b12f1da9e152..80f70f1c224ec6fb10f04c29ea2205f47ae553ff:/st.c diff --git a/st.c b/st.c index 6a90176..665dc1a 100644 --- a/st.c +++ b/st.c @@ -245,7 +245,7 @@ static char *getseltext() { ptr = str = malloc (sz); for(y = 0; y < term.row; y++) { for(x = 0; x < term.col; x++) { - if(term.line[y][x].c && (ls=selected(x, y))) { + if(term.line[y][x].state & GLYPH_SET && (ls=selected(x, y))) { *ptr = term.line[y][x].c; ptr++; } @@ -1421,6 +1421,8 @@ resize(XEvent *e) { row = xw.bufh / xw.ch; tresize(col, row); ttyresize(col, row); + xw.bufh = MAX(1, xw.bufh); + xw.bufw = MAX(1, xw.bufw); XFreePixmap(xw.dis, xw.buf); xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); draw(SCREEN_REDRAW); @@ -1431,12 +1433,14 @@ run(void) { XEvent ev; fd_set rfd; int xfd = XConnectionNumber(xw.dis); - long mask = ExposureMask | KeyPressMask | StructureNotifyMask | FocusChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask; + long mask = ExposureMask | KeyPressMask | StructureNotifyMask + | FocusChangeMask | PointerMotionMask | ButtonPressMask + | ButtonReleaseMask; XSelectInput(xw.dis, xw.win, mask); XResizeWindow(xw.dis, xw.win, xw.w, xw.h); /* XXX: fix resize bug in wmii (?) */ - while(1) { + for(;;) { FD_ZERO(&rfd); FD_SET(cmdfd, &rfd); FD_SET(xfd, &rfd);