From 4535823ca886a6c53178924ccf70a877e1f63e86 Mon Sep 17 00:00:00 2001 From: nerix Date: Sun, 7 Jul 2024 12:41:21 +0200 Subject: [PATCH] fix: use selected window for `/clearmessages` (#5489) --- CHANGELOG.md | 1 + src/controllers/commands/builtin/Misc.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74acfc0bbdb..1f8be9a5f2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - Bugfix: Fixed message history occasionally not loading after a sleep. (#5457) - Bugfix: Fixed a crash when tab completing while having an invalid plugin loaded. (#5401) - Bugfix: Fixed windows on Windows not saving correctly when snapping them to the edges. (#5478) +- Bugfix: Fixed `/clearmessages` not working with more than one window. (#5489) - Dev: Update Windows build from Qt 6.5.0 to Qt 6.7.1. (#5420) - Dev: Update vcpkg build Qt from 6.5.0 to 6.7.0, boost from 1.83.0 to 1.85.0, openssl from 3.1.3 to 3.3.0. (#5422) - Dev: Unsingletonize `ISoundController`. (#5462) diff --git a/src/controllers/commands/builtin/Misc.cpp b/src/controllers/commands/builtin/Misc.cpp index e1940271a36..caf532c62ad 100644 --- a/src/controllers/commands/builtin/Misc.cpp +++ b/src/controllers/commands/builtin/Misc.cpp @@ -401,11 +401,11 @@ QString clearmessages(const CommandContext &ctx) { (void)ctx; - auto *currentPage = dynamic_cast(getIApp() - ->getWindows() - ->getMainWindow() - .getNotebook() - .getSelectedPage()); + auto *currentPage = getIApp() + ->getWindows() + ->getLastSelectedWindow() + ->getNotebook() + .getSelectedPage(); if (auto *split = currentPage->getSelectedSplit()) {