From c78e41014074b626cc4644030a530dc46871a868 Mon Sep 17 00:00:00 2001 From: wrmr Date: Mon, 23 Jun 2025 14:28:44 -0400 Subject: clarify the reason to shorten ctime() being to drop trailing newline --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index e9368a4..0c321a0 100644 --- a/main.c +++ b/main.c @@ -317,7 +317,8 @@ void gfx_draw_post(GfxPost *post, int y, int x, int width) { color_set(CPAIR_TIME, 0); char *tstamp = ctime(&(time_t){post->src->timestamp.tv_sec}); - mvaddnstr(y, x + width - strlen(tstamp) - 1, tstamp, strlen(tstamp) - 1); + tstamp[strlen(tstamp) - 1] = '\0'; /* remove trailing newline */ + mvaddstr(y, x + width - strlen(tstamp), tstamp); color_set(CPAIR_USER, 0); mvaddnstr(y, x + 2, post->src->user.s, post->src->user.n); -- cgit 1.4.1-2-gfad0