foreseen

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

commit 4ec45f38831837ba3a6bd86f9b45b0a17924edd5
parent 56ec98e1a6ae3c54a8572d2999d63b37146088c8
Author: Andrew Laack <andrew@laack.co>
Date:   Sat, 10 Oct 2026 08:49:09 -0500

Fixed rendering issue with long bottom text

Co-authored-by: Vim

Diffstat:
Mdocs/POSSIBLE_CHANGES | 2++
Msrc/render.cpp | 13+++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/docs/POSSIBLE_CHANGES b/docs/POSSIBLE_CHANGES @@ -11,3 +11,5 @@ - 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? +- the input box can be cut off and that's sometimes annoying, esp. for longer meta lines under the 1x status codes +- Should I url encode the loading: thing for relative links? Should I try to get the entire link? diff --git a/src/render.cpp b/src/render.cpp @@ -206,18 +206,22 @@ void draw(DrawState& ds) { if (ds.timeToClearBottomText <= now) { ds.bottomText = ""; } else { - move(ds.lines - 1, - (ds.columns / 2) - ((int)ds.bottomText.size() / 2)); - attron(A_BOLD); std::string tr = ds.bottomText; std::string truncated; + for (auto& ch : tr) { truncated += (char)toascii(ch); } - if ((int)ds.bottomText.size() > ds.columns) { + + if ((int)truncated.size() > ds.columns) { truncated = truncated.substr(0, ds.columns - 3) + "..."; } + + move(ds.lines - 1, + (ds.columns / 2) - ((int)truncated.size() / 2)); + attron(A_BOLD); + addstr(truncated.c_str()); attroff(A_BOLD); } @@ -362,6 +366,7 @@ void handleResult(DrawState& ds, SiteLoadPair result) { } void tryVisitSite(DrawState& ds, Browser& b, std::string site) { + // Should this be url encoded? Would that be better for users or like this? ds.bottomText = "Loading: " + site; ds.timeToClearBottomText = getCurrentTime() + 5000; draw(ds);