This repository was archived by the owner on Dec 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Use buffer caches to save rendered pages and prevent unnecessary re-rendering #21
Copy link
Copy link
Open
Labels
uiUser interfaceUser interface
Description
Most of the code for saving and restoring ncurses buffers has already been added, but they are currently not being used. The idea is that once a page has been rendered using the page tokens, we want to quickly be able to show it again without going through each token again.
The buffer cache array can store a maximum of MAX_PAGE_COLLECTION_SIZE as defined by:
Line 8 in 2c833c4
| #define MAX_PAGE_COLLECTION_SIZE 10 |
Lines 11 to 27 in 2c833c4
| static void save_view_buffer() { | |
| assert(current_page_index >= 0); | |
| assert(current_page_index < MAX_PAGE_COLLECTION_SIZE); | |
| mvwinstr(content_win, PAGE_LINES, PAGE_COLS, page_cache[current_page_index]); | |
| } | |
| static void restore_page_buffer(int index) { | |
| assert(index >= 0); | |
| assert(index < MAX_PAGE_COLLECTION_SIZE); | |
| if (page_cache[index][0] == '\0') { | |
| return; | |
| } | |
| mvwaddstr(content_win, PAGE_LINES, PAGE_COLS, page_cache[index]); | |
| page_cache[index][0] = '\0'; | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
uiUser interfaceUser interface