Public Access
Gemini: read big pages from the card as you scroll (Q88)
A page larger than memory allows is now windowed instead of cut: one pass over its file (cache or Saved Page) counts lines, indexes every 64th (offset, and the preformatted state there in bit 31: about 1 KB for a 1 MB page) and loads the first window. Scrolling near either end reads the next or previous window on the Gemini task; the line on top of the screen stays put, the scrollbar follows the whole page, and Tab at a window's edge pages on instead of wrapping. Window budgets count the memory the old window gives back. Display pages alternate between two cache files so the one on screen is never overwritten by the next fetch; jobs use a third. On the device, Cosmos with IRC connected: 226 of 419 lines at first, then lines 192-419, back to 64 and 0 while scrolling. `key space` added to the console's key command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -37,6 +37,12 @@ class GeminiApp : public App {
|
||||
bool isSaved() const { return !page_.savedFrom.empty(); }
|
||||
std::string savedPathOf() const { return page_.url.substr(7); } // file://…
|
||||
void show(GeminiPage&& page);
|
||||
void analyse(); // types and links of the lines in memory
|
||||
void applyWindow(GeminiPage&& window);
|
||||
void requestWindow(size_t firstLine);
|
||||
size_t topLine() const; // the source line (in the whole page) at the top of the screen
|
||||
bool moreBelow() const { return page_.windowed && page_.windowStart + page_.text.lineCount() < page_.totalLines; }
|
||||
bool moreAbove() const { return page_.windowed && page_.windowStart > 0; }
|
||||
void showMessage(const std::string& url, const std::string& gemtext);
|
||||
void layout(Canvas& c);
|
||||
void drawLine(Canvas& c, size_t index, int firstRow, int y, int rows);
|
||||
@@ -55,6 +61,8 @@ class GeminiApp : public App {
|
||||
int topRow_ = 0, hscroll_ = 0;
|
||||
int selected_ = -1; // into links_
|
||||
int restoreRow_ = -1; // going back: where that page was scrolled to, applied after layout
|
||||
bool windowLoading_ = false;
|
||||
long keepLine_ = -1; // a new window: the source line to keep at the top, applied after layout
|
||||
std::vector<Visit> history_;
|
||||
bool loading_ = false;
|
||||
std::string loadingUrl_, status_;
|
||||
|
||||
Reference in New Issue
Block a user