diff --git a/src/vteseq.c b/src/vteseq.c
index b6c8624..5074aed 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -96,9 +96,10 @@ vte_g_array_fill(GArray *array, gpointer
 	}
 	g_assert(item != NULL);
 
-	while (array->len < final_size) {
+	final_size -= array->len;
+	do {
 		g_array_append_vals(array, item, 1);
-	}
+	} while (--final_size);
 }
 
 
