From 4fbd2260670f40538944f97fcd7509aecf2ea875 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 13 Jan 2022 13:10:53 +0300 Subject: [PATCH] Fix selection of monospace text on press. --- ui/text/text.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ui/text/text.cpp b/ui/text/text.cpp index 62b4b86..db534d0 100644 --- a/ui/text/text.cpp +++ b/ui/text/text.cpp @@ -2639,6 +2639,7 @@ private: eSetFont(block); if (_p) { const auto isMono = IsMono(block->flags()); + _background = {}; if (block->spoilerIndex()) { const auto handler = _t->_spoilers.at(block->spoilerIndex() - 1); @@ -2663,14 +2664,12 @@ private: *_background.color); mutableCache.color = (*_background.color)->c; } - } else if (isMono && block->lnkIndex()) { - _background = { - .selectActiveBlock = ClickHandler::showAsPressed( - _t->_links.at(block->lnkIndex() - 1)), - }; - } else { - _background = {}; } + if (isMono && block->lnkIndex() && !_background.inFront) { + _background.selectActiveBlock = ClickHandler::showAsPressed( + _t->_links.at(block->lnkIndex() - 1)); + } + if (isMono) { _currentPen = &_textPalette->monoFg->p; _currentPenSelected = &_textPalette->selectMonoFg->p;