commit a0f9e2c7e081db48df0418f42faba979a4f53d5b
parent 24d4aa82f41fdf3b990dd542ba6e8fee8432516b
Author: Andrew Laack <andrew@laack.co>
Date: Thu, 24 Sep 2026 09:14:27 -0500
Precondition check in break lines, fixed issue with cli parsing
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/main.cpp b/src/main.cpp
@@ -274,9 +274,9 @@ int main(int argc, char** argv) {
if(argc > 1) {
// TODO: This should have tests.
- std::string path = "file:///" + std::filesystem::current_path().string() + "/" + argv[1];
- if(std::filesystem::exists(path)) {
+ if(std::filesystem::exists(argv[1])) {
+ std::string path = "file:///" + std::filesystem::current_path().string() + "/" + argv[1];
b.goToSite(path,true);
} else {
b.goToSite(std::string {"gemini://"} + argv[1], true);
diff --git a/src/utils.cpp b/src/utils.cpp
@@ -155,8 +155,13 @@ std::string getNewTab() {
// WIDTH IS INCLUSIVE
std::vector<std::pair<std::string, TextRender>> breakLines(std::vector<std::pair<std::string, TextRender>>& strLs, int width) {
+
std::vector<std::pair<std::string, TextRender>> res {};
+ if(width <= 0) {
+ return res;
+ }
+
for(std::size_t i = 0; i < strLs.size(); ++i) {
std::string cstr = strLs[i].first;