diff options
author | wrmr | 2025-06-25 19:57:23 -0400 |
---|---|---|
committer | wrmr | 2025-06-25 19:57:23 -0400 |
commit | 7c5dddfb971ae6c9f857178cd181cbd75f911030 (patch) | |
tree | 8db3ebf68afb50685f07e6452bb4d3c9dee925a0 /main.c | |
parent | c24854d8e758a771061f49333dadecd7321f251e (diff) |
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/main.c b/main.c index 9923385..6c2f871 100644 --- a/main.c +++ b/main.c @@ -5,7 +5,6 @@ /* TODO: * - * - add a scrollbar! on the right! * - maybe remove ncurses dependency * - consider setting up a proper log file for log_warn / log_err stuff * @@ -43,6 +42,7 @@ #define GFX_MARGIN_Y 1 #define GFX_TEXT_MARGIN_X 1 #define GFX_TEXT_MARGIN_Y 0 +#define GFX_POST_SPACING 1 /* colors */ @@ -321,7 +321,7 @@ typedef struct { } Gfx; int gfx_post_width(void) { - return getmaxx(stdscr) - GFX_MARGIN_X * 2 - 2; + return getmaxx(stdscr) - GFX_MARGIN_X * 2; } int gfx_wrap_width(void) { @@ -370,13 +370,13 @@ void gfx_draw_post(GfxPost *post, int y, int x, int width) { post->drawn = 1; } - int left = x, top = y, right = x + width, bottom = y + height - 1; + int left = x, top = y, right = x + width - 1, bottom = y + height - 1; color_set(CPAIR_BORDER, 0); - gfx_hline(top, left, width, ACS_HLINE); + gfx_hline(top, left, right - left, ACS_HLINE); gfx_vline(top, left, height - 1, ACS_VLINE); gfx_vline(top, right, height - 1, ACS_VLINE); - gfx_hline(bottom, left, width, ACS_HLINE); + gfx_hline(bottom, left, right - left, ACS_HLINE); mvaddch(bottom, right, ACS_LRCORNER); mvaddch(bottom, left, ACS_LLCORNER); @@ -385,7 +385,7 @@ void gfx_draw_post(GfxPost *post, int y, int x, int width) { color_set(CPAIR_TIME, 0); Str s = str_trim(str_from_cstr(ctime(&(time_t){post->src->timestamp.tv_sec}))); - mvaddnstr(y, x + width - s.n, s.s, s.n); + mvaddnstr(y, right - s.n, s.s, s.n); color_set(CPAIR_USER, 0); mvaddnstr(y, x + 2, post->src->user.s, post->src->user.n); @@ -404,7 +404,7 @@ void gfx_draw(Gfx *gfx, int cur) { 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, width); - y += gfx_post_height(&gfx->posts[i]) + 1; + y += gfx_post_height(&gfx->posts[i]) + GFX_POST_SPACING; } } |