diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1269,12 +1269,15 @@ int load_config(Arena *perm, Arena *temp) { /* main */ -void view_long_help(void) { +void page_string(Str txt) { fini_curses(); - FILE *f = popen("less", "w"); + /* -c to prevent screen-not-fully-cleared weirdness */ + FILE *f = popen("less -c", "w"); if (f) { - fputs(help_long, f); + fwrite(txt.s, 1, txt.n, f); pclose(f); + } else { + log_err("failed to open less"); } init_curses(); } @@ -1383,16 +1386,14 @@ resize: gfx_load(&gfx, &posts, &gfx_arena); break; case 'v': - fini_curses(); - system(cstr_fmt(&temp_arena, "less %s", posts.data[cur].path)); - init_curses(); + page_string(posts.data[cur].text); break; case 'i': gfx_draw_user(posts.data[cur].user, &temp_arena); (void)getch(); break; case '?': - view_long_help(); + page_string(str_from_cstr(help_long)); break; } } |
