X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;ds=sidebyside;f=st.c;h=79bf1c8cb3ae1afd3c929bf4f984e551031171ac;hb=39ae1a4de5c471c8626c80ef1e961f0c83f5199d;hp=0065240f40705cf2a6ad1b72f5fde256f4b748cc;hpb=6f5f7701864e6987544cb7e7dc5f2d24db1a4537;p=st.git diff --git a/st.c b/st.c index 0065240..79bf1c8 100644 --- a/st.c +++ b/st.c @@ -944,7 +944,7 @@ getsel(void) { ptr = str = xmalloc(bufsize); /* append every set & selected glyph to the selection */ - for(y = sel.nb.y; y < sel.ne.y + 1; y++) { + for(y = sel.nb.y; y <= sel.ne.y; y++) { linelen = tlinelen(y); if(sel.type == SEL_RECTANGULAR) { @@ -2779,18 +2779,16 @@ tresize(int col, int row) { return; } - /* free unneeded rows */ - i = 0; + /* + * slide screen to keep cursor where we expect it - + * tscrollup would work here, but we can optimize to + * memmove because we're freeing the earlier lines + */ + for(i = 0; i < slide; i++) { + free(term.line[i]); + free(term.alt[i]); + } if(slide > 0) { - /* - * slide screen to keep cursor where we expect it - - * tscrollup would work here, but we can optimize to - * memmove because we're freeing the earlier lines - */ - for(/* i = 0 */; i < slide; i++) { - free(term.line[i]); - free(term.alt[i]); - } memmove(term.line, term.line + slide, row * sizeof(Line)); memmove(term.alt, term.alt + slide, row * sizeof(Line)); } @@ -3591,15 +3589,15 @@ xdrawcursor(void) { case 4: /* Steady Underline */ XftDrawRect(xw.draw, &dc.col[defaultcs], borderpx + curx * xw.cw, - borderpx + (term.c.y + 1) * xw.ch - 1, - xw.cw, 1); + borderpx + (term.c.y + 1) * xw.ch - cursorthickness, + xw.cw, cursorthickness); break; case 5: /* Blinking bar */ case 6: /* Steady bar */ XftDrawRect(xw.draw, &dc.col[defaultcs], - borderpx + curx * xw.cw, - borderpx + term.c.y * xw.ch, - 1, xw.ch); + borderpx + curx * xw.cw, + borderpx + term.c.y * xw.ch, + cursorthickness, xw.ch); break; } } else { @@ -3917,17 +3915,13 @@ run(void) { long deltatime; /* Waiting for window mapping */ - while(1) { + do { XNextEvent(xw.dpy, &ev); - if(XFilterEvent(&ev, None)) - continue; if(ev.type == ConfigureNotify) { w = ev.xconfigure.width; h = ev.xconfigure.height; - } else if(ev.type == MapNotify) { - break; } - } + } while(ev.type != MapNotify); ttynew(); cresize(w, h); @@ -4072,7 +4066,7 @@ main(int argc, char *argv[]) { run: setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); - tnew(cols? cols : 1, rows? rows : 1); + tnew(MAX(cols, 1), MAX(rows, 1)); xinit(); selinit(); run();