foreseen

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

commit e64806dea08d7f393f01db74fd65b4a9b3f466c2
parent ddfe17f0f0195ee38f407a1db7e97d8ada8bcb34
Author: Andrew Laack <andrew@laack.co>
Date:   Fri, 25 Sep 2026 12:06:53 -0500

Fixed regressions

Diffstat:
Msrc/main.cpp | 4++--
Msrc/utils.cpp | 6++++++
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp @@ -17,7 +17,7 @@ int lowestPos(std::vector<std::pair<std::string, TextRender>>& strLs) { - return (strLs.size() - (LINES - 2)); + return (strLs.size() - (LINES - 2)) + 1; // this gives us two new lines at the end because the last line should contain a \n. } const int maxWidth = 80; @@ -42,7 +42,7 @@ void removeNonAscii(std::vector<std::pair<std::string, TextRender>>& strLs) { std::string out; for (int c: s) - if (c >= 0x20 && c <= 0x7E) { + if (c >= 0x20 && c <= 0x7E || c == '\n') { out += c; } else if (c == '\t') { out += " "; // \t is a larger character and fucks with breaklines. diff --git a/src/utils.cpp b/src/utils.cpp @@ -188,6 +188,12 @@ std::vector<std::pair<std::string, TextRender>> breakLines(std::vector<std::pair int lastSpace = -1; for(int x = 0; x < cstr.size(); ++x) { + if(cstr[x] == '\n') { + res.push_back(std::pair<std::string,TextRender> {leftPadStr + current, strLs[i].second}); + current = ""; + lastSpace = -1; + continue; + } if(current.size() < width) { current.push_back(cstr[x]); if(cstr[x] == ' ') {