Fix selection rendering (#4830)
The rendering of selections was not aligned to the actual selection that took place for newlines at the end of messages, if they were the only part that was selected of that message. In addition to that fix, we've already refactored the MessageLayoutContainer to try to make it a little bit more sane to work with in the future. Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -143,7 +143,7 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags flags)
|
||||
bool hideSimilar = getSettings()->hideSimilar;
|
||||
bool hideReplies = !flags.has(MessageElementFlag::RepliedMessage);
|
||||
|
||||
this->container_.begin(width, this->scale_, messageFlags);
|
||||
this->container_.beginLayout(width, this->scale_, messageFlags);
|
||||
|
||||
for (const auto &element : this->message_->elements)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ void MessageLayout::actuallyLayout(int width, MessageElementFlags flags)
|
||||
this->deleteBuffer();
|
||||
}
|
||||
|
||||
this->container_.end();
|
||||
this->container_.endLayout();
|
||||
this->height_ = this->container_.getHeight();
|
||||
|
||||
// collapsed state
|
||||
@@ -424,17 +424,17 @@ const MessageLayoutElement *MessageLayout::getElementAt(QPoint point)
|
||||
return this->container_.getElementAt(point);
|
||||
}
|
||||
|
||||
int MessageLayout::getLastCharacterIndex() const
|
||||
size_t MessageLayout::getLastCharacterIndex() const
|
||||
{
|
||||
return this->container_.getLastCharacterIndex();
|
||||
}
|
||||
|
||||
int MessageLayout::getFirstMessageCharacterIndex() const
|
||||
size_t MessageLayout::getFirstMessageCharacterIndex() const
|
||||
{
|
||||
return this->container_.getFirstMessageCharacterIndex();
|
||||
}
|
||||
|
||||
int MessageLayout::getSelectionIndex(QPoint position)
|
||||
size_t MessageLayout::getSelectionIndex(QPoint position) const
|
||||
{
|
||||
return this->container_.getSelectionIndex(position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user