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:
@@ -62,9 +62,23 @@ public:
|
||||
|
||||
// Elements
|
||||
const MessageLayoutElement *getElementAt(QPoint point);
|
||||
int getLastCharacterIndex() const;
|
||||
int getFirstMessageCharacterIndex() const;
|
||||
int getSelectionIndex(QPoint position);
|
||||
|
||||
/**
|
||||
* Get the index of the last character in this message's container
|
||||
* This is the sum of all the characters in `elements_`
|
||||
*/
|
||||
size_t getLastCharacterIndex() const;
|
||||
|
||||
/**
|
||||
* Get the index of the first visible character in this message's container
|
||||
* This is not always 0 in case there elements that are skipped
|
||||
*/
|
||||
size_t getFirstMessageCharacterIndex() const;
|
||||
|
||||
/**
|
||||
* Get the character index at the given position, in the context of selections
|
||||
*/
|
||||
size_t getSelectionIndex(QPoint position) const;
|
||||
void addSelectionText(QString &str, uint32_t from = 0,
|
||||
uint32_t to = UINT32_MAX,
|
||||
CopyMode copymode = CopyMode::Everything);
|
||||
|
||||
Reference in New Issue
Block a user