diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f0be283..d63db450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ - Dev: Bumped clang-format requirement to 19. (#6236) - Dev: Factored out AUMID to `Version`. (#6321) - Dev: Silenced some warnings when compiling with clang-cl. (#6331) +- Dev: Added some commands for forcing a relayout (and related things) in channel views. (#6342) ## 2.5.3 diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 80a67254..5dcf0e44 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -462,6 +462,15 @@ CommandController::CommandController(const Paths &paths) this->registerCommand("/debug-force-image-unload", &commands::forceImageUnload); + this->registerCommand("/debug-force-layout-channel-views", + &commands::forceLayoutChannelViews); + + this->registerCommand("/debug-increment-image-generation", + &commands::incrementImageGeneration); + + this->registerCommand("/debug-invalidate-buffers", + &commands::invalidateBuffers); + this->registerCommand("/debug-test", &commands::debugTest); this->registerCommand("/shield", &commands::shieldModeOn); diff --git a/src/controllers/commands/builtin/chatterino/Debugging.cpp b/src/controllers/commands/builtin/chatterino/Debugging.cpp index d1517dd3..88a73460 100644 --- a/src/controllers/commands/builtin/chatterino/Debugging.cpp +++ b/src/controllers/commands/builtin/chatterino/Debugging.cpp @@ -14,6 +14,7 @@ #include "providers/twitch/TwitchIrcServer.hpp" #include "singletons/Theme.hpp" #include "singletons/Toasts.hpp" +#include "singletons/WindowManager.hpp" #include "util/PostToThread.hpp" #include @@ -139,6 +140,24 @@ QString forceImageUnload(const CommandContext &ctx) return ""; } +QString forceLayoutChannelViews(const CommandContext & /*ctx*/) +{ + getApp()->getWindows()->forceLayoutChannelViews(); + return {}; +} + +QString incrementImageGeneration(const CommandContext & /*ctx*/) +{ + getApp()->getWindows()->incGeneration(); + return {}; +} + +QString invalidateBuffers(const CommandContext & /*ctx*/) +{ + getApp()->getWindows()->invalidateChannelViewBuffers(); + return {}; +} + QString debugTest(const CommandContext &ctx) { if (!ctx.channel) diff --git a/src/controllers/commands/builtin/chatterino/Debugging.hpp b/src/controllers/commands/builtin/chatterino/Debugging.hpp index 0cfa448e..5208f3c6 100644 --- a/src/controllers/commands/builtin/chatterino/Debugging.hpp +++ b/src/controllers/commands/builtin/chatterino/Debugging.hpp @@ -22,6 +22,12 @@ QString forceImageGarbageCollection(const CommandContext &ctx); QString forceImageUnload(const CommandContext &ctx); +QString forceLayoutChannelViews(const CommandContext &ctx); + +QString incrementImageGeneration(const CommandContext &ctx); + +QString invalidateBuffers(const CommandContext &ctx); + QString debugTest(const CommandContext &ctx); } // namespace chatterino::commands diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 21d5c34a..9e4999cd 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -735,8 +735,8 @@ void ChannelView::layoutVisibleMessages( y += message->getHeight(); } + this->bufferInvalidationQueued_ = false; } - this->bufferInvalidationQueued_ = false; if (redrawRequired) {