commit 8b78d253db57b5f8eb03c77b4a6382299f8c0ad5
parent fff7ae305f9a33052657b51f6c9438234ccaf9d6
Author: Andrew Laack <andrew@laack.co>
Date: Mon, 28 Sep 2026 16:03:43 -0500
Better formatting, not a fan of all the locations though.
Diffstat:
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/heading.cpp b/src/heading.cpp
@@ -26,11 +26,11 @@ Heading::Heading(std::string text) : actualText(text) {
std::string Heading::textToDraw() {
switch (headingLevel) {
case 3:
- return "### " + toDraw;
+ return "### " + toDraw + "\n";
case 2:
- return "## " + toDraw;
+ return "## " + toDraw + "\n";
case 1:
- return "# " + toDraw;
+ return "# " + toDraw + "\n";
default:
throw NotImplemented();
}
diff --git a/src/link.cpp b/src/link.cpp
@@ -102,7 +102,7 @@ std::optional<std::string> Link::getLinkText() {
}
std::string Link::textToDraw() {
- return renderedText;
+ return renderedText + "\n";
}
int Link::getColor() {
diff --git a/src/list-item.cpp b/src/list-item.cpp
@@ -8,7 +8,7 @@ ListItem::ListItem(std::string input) {
}
std::string ListItem::textToDraw() {
- return textToRender;
+ return textToRender + "\n";
}
int ListItem::getColor() {
diff --git a/src/plaintext.cpp b/src/plaintext.cpp
@@ -3,7 +3,7 @@
Plaintext::Plaintext(std::string input) : text(input) {}
std::string Plaintext::textToDraw() {
- return text;
+ return text + "\n";
}
int Plaintext::getColor() {
diff --git a/src/preformatted.cpp b/src/preformatted.cpp
@@ -5,7 +5,7 @@
Preformatted::Preformatted(std::string input) : text(input) {}
std::string Preformatted::textToDraw() {
- return text;
+ return text + "\n";
}
int Preformatted::getColor() {
diff --git a/src/quote.cpp b/src/quote.cpp
@@ -9,7 +9,7 @@ Quote::Quote(std::string input) {
}
std::string Quote::textToDraw() {
- return textToRender;
+ return textToRender + "\n";
}
int Quote::getColor() {
diff --git a/tests/pure-test.cpp b/tests/pure-test.cpp
@@ -179,7 +179,7 @@ TEST_CASE("Test line parsing handles whitespace correctly") {
std::string check = prefix.first + acc + "test line content";
auto ln = lineToLine(check, std::nullopt, 1, false);
REQUIRE(ln->type() == prefix.second);
- REQUIRE(ln->textToDraw() == prefix.first + " test line content");
+ REQUIRE(ln->textToDraw() == prefix.first + " test line content\n");
acc += options[rand() % 2];
}
}
@@ -192,7 +192,7 @@ TEST_CASE("Test line parsing handles whitespace correctly") {
std::string check = "=>" + acc + "gemini://laack.co" + acc + "link human text";
auto ln = lineToLine(check, std::nullopt, 1, false);
REQUIRE(ln->type() == LINK);
- REQUIRE(ln->textToDraw() == "[1] link human text");
+ REQUIRE(ln->textToDraw() == "[1] link human text\n");
acc += options[rand() % 2];
}
}