commit 87897854adc107cbf416f99f5d511e86bdd75c7f
parent 669430aabaab0a7dd64b2445d906ef00d74c767d
Author: citbl <citbl@citbl.org>
Date: Fri, 10 Oct 2025 20:22:11 +1000
minor fixes
Diffstat:
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/TODO b/TODO
@@ -1,7 +1,7 @@
show more
show domains
show ending (html|pdf)
-caching, persist links and seen
+~caching, persist links and seen~
instant display
background fetching
status bar
diff --git a/render.c b/render.c
@@ -23,12 +23,12 @@ draw_bars(void)
}
for (i = 0; i < width; i++) {
- tb_set_cell(i, 2, HORIZ_LINE, LINE_COLOR, BACK_COLOR);
+ tb_set_cell(i, 1, HORIZ_LINE, LINE_COLOR, BACK_COLOR);
tb_set_cell(i, height - 2, HORIZ_LINE, LINE_COLOR, BACK_COLOR);
}
- tb_print(1, 1, LOGO_COLOR, BACK_COLOR, "readr");
- tb_print(width - 5, 1, TEXT_COLOR, BACK_COLOR, VERSION);
+ tb_print(1, 0, LOGO_COLOR, BACK_COLOR, "readr");
+ tb_print(width - 5, 0, TEXT_COLOR, BACK_COLOR, VERSION);
tb_print(width - 66,
height - 1,
TEXT_COLOR,
@@ -37,9 +37,9 @@ draw_bars(void)
// corners top
- tb_set_cell(0, 2, 0x250C, LINE_COLOR, BACK_COLOR);
- tb_set_cell(FEED_CAP + 5, 2, 0x252C, LINE_COLOR, BACK_COLOR);
- tb_set_cell(width - 1, 2, 0x2510, LINE_COLOR, BACK_COLOR);
+ tb_set_cell(0, 1, 0x250C, LINE_COLOR, BACK_COLOR);
+ tb_set_cell(FEED_CAP + 5, 1, 0x252C, LINE_COLOR, BACK_COLOR);
+ tb_set_cell(width - 1, 1, 0x2510, LINE_COLOR, BACK_COLOR);
// corners bottom
@@ -65,6 +65,7 @@ render(app_t* app)
db_post_t* post;
feed_t* feed;
feed_t* selected_feed = app->feeds[app->selected_feed];
+ int buffer_height = tb_height() - 3 - 3;
draw_background();
draw_bars();
@@ -79,10 +80,14 @@ render(app_t* app)
else
color = (FEED_COLOR | TB_DIM);
- tb_print(2, 4 + i, color, BACK_COLOR, feed->title ? feed->title : "N/A");
+ tb_print(2, 3 + i, color, BACK_COLOR, feed->title ? feed->title : "N/A");
}
- for (i = 0; i < selected_feed->posts_len; i++) {
+ // posts
+
+ int visible_len = MIN(buffer_height, selected_feed->posts_len);
+
+ for (i = 0; i < visible_len; i++) {
post = selected_feed->posts[i];
title_len = MIN(TITLE_CAP, strlen(post->title));
strncpy(title, post->title, title_len);
@@ -98,7 +103,7 @@ render(app_t* app)
else
color = (POST_COLOR);
- tb_print(FEED_CAP + 10, 4 + i, color, BACK_COLOR, title);
+ tb_print(FEED_CAP + 10, 3 + i, color, BACK_COLOR, title);
}
tb_present();