foreseen

A text-based gemini browser with prefetching
git clone git://git.laack.co/foreseen.git
Log | Files | Refs | README | LICENSE

commit 63e2d68eb6435b8f18d4bba59488701734a679ed
parent b673cf2c1e1272bb4ffb0149501c0614dff924f2
Author: Andrew Laack <andrew@laack.co>
Date:   Thu,  8 Oct 2026 16:15:47 -0500

Updated todos

Co-authored-by: Vim

Diffstat:
Mdocs/POSSIBLE_CHANGES | 1+
Mdocs/TODO | 8--------
Msrc/main.cpp | 4++--
Msrc/render.cpp | 25++++++++++++++-----------
Msrc/utils.cpp | 1-
5 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/docs/POSSIBLE_CHANGES b/docs/POSSIBLE_CHANGES @@ -10,3 +10,4 @@ - url manipulation - sometimes it's nice to go from {example}.com/blog/whatever -> {example}.com/blog without having to find links. - issue text should perhaps replace the url for a bit? +- replace header with issue text when appropriate? diff --git a/docs/TODO b/docs/TODO @@ -13,11 +13,3 @@ - move shared.hpp -> config.hpp - refactor non-runtime configurable values to be set in hpp file - inject these into about://newtab - ---- - -- replace header with issue text when appropriate - ---- - -- consider different sizing for screen to make bottom text look nicer diff --git a/src/main.cpp b/src/main.cpp @@ -100,9 +100,9 @@ int main(int argc, char** argv) { // startup. // this guarantees invariants we expect about ds - // we could set cols and lines here, but it's better to do this. + // we could set cols and lines here, but it's better to do this. - mainLoop(ds, b, KEY_RESIZE , COLS, LINES); + mainLoop(ds, b, KEY_RESIZE, COLS, LINES); tryVisitSite(ds, b, cliDestination.destination); } diff --git a/src/render.cpp b/src/render.cpp @@ -95,7 +95,8 @@ void draw(DrawState& ds) { refresh(); return; } - if (ds.lines < 5) { // This is the min size that still allows top and bottom padding along with one line of text. + if (ds.lines < 5) { // This is the min size that still allows top and + // bottom padding along with one line of text. erase(); addstr("Screen height too small."); refresh(); @@ -200,12 +201,13 @@ void draw(DrawState& ds) { } } - if(ds.bottomText != "") { + if (ds.bottomText != "") { uint64_t now = getCurrentTime(); if (ds.timeToClearBottomText <= now) { ds.bottomText = ""; } else { - move(ds.lines-1,(ds.columns / 2) - ((int)ds.bottomText.size() / 2)); + move(ds.lines - 1, + (ds.columns / 2) - ((int)ds.bottomText.size() / 2)); attron(A_BOLD); std::string tr = ds.bottomText; @@ -219,7 +221,6 @@ void draw(DrawState& ds) { addstr(truncated.c_str()); attroff(A_BOLD); } - } refresh(); @@ -387,9 +388,10 @@ bool mainLoop(DrawState& ds, Browser& b, int input, int cols, int lines) { SiteLoadPair res; switch (destination.t) { case NUMBER_DESTINATION: - ds.bottomText = "Following link: " + std::to_string(destination.linkNumber); - ds.timeToClearBottomText = getCurrentTime() + 5000; - draw(ds); + ds.bottomText = "Following link: " + + std::to_string(destination.linkNumber); + ds.timeToClearBottomText = getCurrentTime() + 5000; + draw(ds); res = b.followLinkNumber(destination.linkNumber); handleResult(ds, res); ds.bottomText = ""; @@ -444,16 +446,17 @@ bool mainLoop(DrawState& ds, Browser& b, int input, int cols, int lines) { } else if (input == CTRL('u')) { ds.y -= ds.lines / 2; } else if (input == 'r' || input == CTRL('r')) { - ds.bottomText = "Refreshing " + b.getCurrentLink()->getLinkDestination().to_string(); + ds.bottomText = "Refreshing " + + b.getCurrentLink()->getLinkDestination().to_string(); ds.timeToClearBottomText = getCurrentTime() + 5000; draw(ds); b.refresh(); ds.mustReRender = true; ds.bottomText = ""; } else if (input == 'f') { - b.goForward(); // TODO: it's possible this might not be in - // cache, but probably not worth bothering with rendering - // loading text. + b.goForward(); // TODO: it's possible this might not be in + // cache, but probably not worth bothering with + // rendering loading text. ds.mustReRender = true; ds.y = 0; } else if (input == 'd') { diff --git a/src/utils.cpp b/src/utils.cpp @@ -414,7 +414,6 @@ Destination handleDestinationResolution(std::string destination, bool isCli) { void sanitizeCharactersToDraw( std::vector<std::pair<std::string, TextRender>>& strLs) { - for (std::size_t i = 0; i < strLs.size(); ++i) { std::string& s = strLs[i].first; std::string out;