St has a bug where characters are always cropped slightly off of the
bottom and right hand sides of the window. I suspect that this is
caused by st not taking into account the border when regenerates the
pixmap during a window resize event.

I've attached a patch that appears to solve the problem for me. I'm
not very experienced with Xlib or C, so hopefully it doesn't
inadvertently introduce some other bug.

Ing
diff -r 5b6474453e77 st.c
--- a/st.c	Tue Apr 27 00:04:29 2010 +0200
+++ b/st.c	Mon May 31 22:23:36 2010 +0100
@@ -1242,16 +1242,17 @@
 void
 resize(XEvent *e) {
 	int col, row;
-	col = e->xconfigure.width / xw.cw;
-	row = e->xconfigure.height / xw.ch;
+	col = (e->xconfigure.width - 2*BORDER) / xw.cw;
+	row = (e->xconfigure.height - 2*BORDER) / xw.ch;
 	
 	if(term.col != col || term.row != row) {
 		tresize(col, row);
 		ttyresize(col, row);
-		xw.w = e->xconfigure.width;
-		xw.h = e->xconfigure.height;
+		xw.w = e->xconfigure.width - 2*BORDER;
+		xw.h = e->xconfigure.height - 2*BORDER;
 		XFreePixmap(xw.dis, xw.buf);
 		xw.buf = XCreatePixmap(xw.dis, xw.win, xw.w, xw.h, XDefaultDepth(xw.dis, xw.scr));
+		XFillRectangle(xw.dis, xw.buf, dc.gc, 0, 0, xw.w, xw.h);
 		draw(SCREEN_REDRAW);
 	}
 }

Reply via email to