summary refs log tree commit diff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/main.c b/main.c
index c5d17c2..c315085 100644
--- a/main.c
+++ b/main.c
@@ -262,15 +262,19 @@ int str_cat_wrap(Str *out, Str s, int width, Arena *a) {
 	return lines;
 }
 
+int gfx_post_width(void) {
+	return getmaxx(stdscr) - GFX_MARGIN_X * 2 - 2;
+}
+
 int gfx_wrap_width(void) {
-	return getmaxx(stdscr) - 2 - GFX_MARGIN_X * 2 - GFX_TEXT_MARGIN_X * 2;
+	return gfx_post_width() - GFX_TEXT_MARGIN_X * 2;
 }
 
 void gfx_load_post(GfxPost *post, Post *src, int width, Arena *a) {
 	memset(post, 0, sizeof(GfxPost));
 	post->src = src;
  	/* subtract two to make room for border */
-	post->lines = str_cat_wrap(&post->text, src->text, width - 2, a);
+	post->lines = str_cat_wrap(&post->text, src->text, width, a);
 	str_catc(&post->text, '\0', a);
 	post->text.n--;
 }
@@ -338,10 +342,10 @@ void gfx_draw_post(GfxPost *post, int y, int x, int width) {
 }
 
 void gfx_draw(Gfx *gfx, int cur) {
-	int wrap_width = gfx_wrap_width();
+	int width = gfx_post_width();
 	erase();
 	for (int i = cur, y = GFX_MARGIN_Y; i < gfx->len && y < getmaxy(stdscr) - GFX_MARGIN_Y; i++) {
-		gfx_draw_post(&gfx->posts[i], y, GFX_MARGIN_X, wrap_width);
+		gfx_draw_post(&gfx->posts[i], y, GFX_MARGIN_X, width);
 		y += gfx_post_height(&gfx->posts[i]) + 1;
 	}
 }