X-Git-Url: https://git.xinqibao.xyz/st.git/blobdiff_plain/0ca0dd8b11ec0febc547e485395b7c9ec01e2866..3ae02990648447ec3252b42f5b64e18818c19fd8:/st.c

diff --git a/st.c b/st.c
index 56dc94c..9587886 100644
--- a/st.c
+++ b/st.c
@@ -1195,23 +1195,10 @@ treset(void) {
 
 void
 tnew(int col, int row) {
-	/* set screen size */
-	term.row = row;
-	term.col = col;
-	term.line = xmalloc(term.row * sizeof(Line));
-	term.alt  = xmalloc(term.row * sizeof(Line));
-	term.dirty = xmalloc(term.row * sizeof(*term.dirty));
-	term.tabs = xmalloc(term.col * sizeof(*term.tabs));
-
-	for(row = 0; row < term.row; row++) {
-		term.line[row] = xmalloc(term.col * sizeof(Glyph));
-		term.alt [row] = xmalloc(term.col * sizeof(Glyph));
-		term.dirty[row] = 0;
-	}
-
+	memset(&term, 0, sizeof(Term));
+	tresize(col, row);
 	term.numlock = 1;
-	memset(term.tabs, 0, term.col * sizeof(*term.tabs));
-	/* setup screen */
+
 	treset();
 }