Fixed emotes selecting the whole line on double-click.

This commit is contained in:
Cranken 2018-10-02 14:13:49 +02:00 committed by pajlada
parent c8326d73e7
commit 335b889efe

View file

@ -1021,7 +1021,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
const MessageLayoutElement *hoverLayoutElement =
layout->getElementAt(relativePos);
// Triple-click next to message selects whole message
// Triple-clicking a message selects the whole message
if (this->clickTimer_->isActive() && this->selecting_) {
this->selectWholeMessage(layout.get(), messageIndex);
}
@ -1200,7 +1200,12 @@ void ChannelView::mouseDoubleClickEvent(QMouseEvent *event)
hoverLayoutElement->getMouseOverIndex(relativePos);
const int wordStart =
layout->getSelectionIndex(relativePos) - mouseInWordIndex;
const int wordEnd = wordStart + hoverLayoutElement->getText().length();
const int selectionLength =
hoverLayoutElement->getSelectionIndexCount();
const int length = hoverLayoutElement->hasTrailingSpace()
? selectionLength - 1
: selectionLength;
const int wordEnd = wordStart + length;
this->clickTimer_->start();