fixed off by one error

This commit is contained in:
fourtf 2018-01-05 03:41:31 +01:00
parent 898d1d26e7
commit 69488eb2ea

View file

@ -165,7 +165,7 @@ void ChannelView::actuallyLayoutMessages()
// layout the messages at the bottom to determine the scrollbar thumb size // layout the messages at the bottom to determine the scrollbar thumb size
int h = height() - 8; int h = height() - 8;
for (std::size_t i = messagesSnapshot.getLength() - 1; i > 0; i--) { for (int i = (int)messagesSnapshot.getLength() - 1; i >= 0; i--) {
auto *message = messagesSnapshot[i].get(); auto *message = messagesSnapshot[i].get();
message->layout(layoutWidth, this->getDpiMultiplier()); message->layout(layoutWidth, this->getDpiMultiplier());
@ -267,8 +267,9 @@ QString ChannelView::getSelectedText()
if (first) { if (first) {
first = false; first = false;
bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex < bool isSingleWord =
part.getCharacterLength(); isSingleMessage &&
this->selection.max.charIndex - charIndex < part.getCharacterLength();
if (isSingleWord) { if (isSingleWord) {
// return single word // return single word
@ -630,9 +631,10 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
// this->selectionMax.messageIndex >= messageIndex) { // this->selectionMax.messageIndex >= messageIndex) {
// painter.fillRect(buffer->rect(), QColor(24, 55, 25)); // painter.fillRect(buffer->rect(), QColor(24, 55, 25));
//} else { //} else {
painter.fillRect(buffer->rect(), (messageRef->getMessage()->containsHighlightedPhrase()) painter.fillRect(buffer->rect(),
? this->themeManager.messages.backgrounds.highlighted (messageRef->getMessage()->containsHighlightedPhrase())
: this->themeManager.messages.backgrounds.regular); ? this->themeManager.messages.backgrounds.highlighted
: this->themeManager.messages.backgrounds.regular);
//} //}
// draw selection // draw selection