diff --git a/src/internal.hpp b/src/internal.hpp index bbbe03b..e1b5ea2 100644 --- a/src/internal.hpp +++ b/src/internal.hpp @@ -61,7 +61,6 @@ constexpr int keyboardBufferSize = 16; std::vector> eventTable; bool localMemoryWarn = true; char *sharedMemory = nullptr; - int maxTextLength = 60; }; extern Impl impl; diff --git a/src/vkvm.cpp b/src/vkvm.cpp index df7927b..6337c99 100644 --- a/src/vkvm.cpp +++ b/src/vkvm.cpp @@ -165,7 +165,7 @@ namespace vkvm { lockSharedMemory(); char *ptr = getTextArea(); for (int i = 0; i < text.size(); i++) { - if (i < getCharactersPerColumn() * getCharactersPerRow() && i < impl.maxTextLength) { + if (i < getCharactersPerColumn() * getCharactersPerRow()) { ptr[i] = text[i]; } } @@ -173,6 +173,7 @@ namespace vkvm { ptr[text.size()] = '\0'; } unlockSharedMemory(); + callEvent(EventType::RenderText); return true; } @@ -183,11 +184,12 @@ namespace vkvm { auto clearText() -> bool { lockSharedMemory(); char *ptr = getTextArea(); - for (int i = 0; i < impl.maxTextLength; ++i) { + for (int i = 0; i < getCharactersPerColumn() * getCharactersPerRow(); ++i) { ptr[i] = '\0'; } unlockSharedMemory(); + callEvent(EventType::RenderText); return true; } diff --git a/test/area_test.cpp b/test/area_test.cpp index 6f5854c..a91ac75 100644 --- a/test/area_test.cpp +++ b/test/area_test.cpp @@ -14,7 +14,7 @@ TEST_CASE("AREA") { SECTION("Out of bounds") { - REQUIRE(!vkvm::setPixel(400, 400, vkvm::white)); + REQUIRE_FALSE(vkvm::setPixel(400, 400, vkvm::white)); REQUIRE(vkvm::getPixel(400, 400) == vkvm::black); vkvm::setBackgroundColor(vkvm::blue); diff --git a/test/text_test.cpp b/test/text_test.cpp index f42b26b..e26baf0 100644 --- a/test/text_test.cpp +++ b/test/text_test.cpp @@ -20,5 +20,5 @@ TEST_CASE("Text") { REQUIRE(vkvm::getCharactersPerRow() == 1); REQUIRE(vkvm::setText("Hello World")); - REQUIRE(vkvm::getText() == "Hello"); + REQUIRE(vkvm::getText() == "Hello World"); } \ No newline at end of file