added basic buggy text copying
This commit is contained in:
@@ -235,48 +235,20 @@ const MessageLayoutElement *MessageLayout::getElementAt(QPoint point)
|
||||
return this->container.getElementAt(point);
|
||||
}
|
||||
|
||||
// XXX(pajlada): This is probably not the optimal way to calculate this
|
||||
int MessageLayout::getLastCharacterIndex() const
|
||||
{
|
||||
// fourtf: xD
|
||||
// // find out in which line the cursor is
|
||||
// int lineNumber = 0, lineStart = 0, lineEnd = 0;
|
||||
|
||||
// for (size_t i = 0; i < this->wordParts.size(); i++) {
|
||||
// const LayoutItem &part = this->wordParts[i];
|
||||
|
||||
// if (part.getLineNumber() != lineNumber) {
|
||||
// lineStart = i;
|
||||
// lineNumber = part.getLineNumber();
|
||||
// }
|
||||
|
||||
// lineEnd = i + 1;
|
||||
// }
|
||||
|
||||
// // count up to the cursor
|
||||
// int index = 0;
|
||||
|
||||
// for (int i = 0; i < lineStart; i++) {
|
||||
// const LayoutItem &part = this->wordParts[i];
|
||||
|
||||
// index += part.getWord().isImage() ? 2 : part.getText().length() + 1;
|
||||
// }
|
||||
|
||||
// for (int i = lineStart; i < lineEnd; i++) {
|
||||
// const LayoutItem &part = this->wordParts[i];
|
||||
|
||||
// index += part.getCharacterLength();
|
||||
// }
|
||||
|
||||
// return index;
|
||||
|
||||
return 0;
|
||||
return this->container.getLastCharacterIndex();
|
||||
}
|
||||
|
||||
int MessageLayout::getSelectionIndex(QPoint position)
|
||||
{
|
||||
return this->container.getSelectionIndex(position);
|
||||
}
|
||||
|
||||
void MessageLayout::addSelectionText(QString &str, int from, int to)
|
||||
{
|
||||
this->container.addSelectionText(str, from, to);
|
||||
}
|
||||
} // namespace layouts
|
||||
} // namespace messages
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user