fixed not being able to select text backwards

This commit is contained in:
fourtf
2018-08-11 17:35:46 +02:00
parent c768bd9bd9
commit 63eaf3b94c
4 changed files with 22 additions and 16 deletions
+4 -9
View File
@@ -1,5 +1,6 @@
#pragma once
#include <tuple>
#include <utility>
namespace chatterino {
@@ -23,19 +24,13 @@ struct SelectionItem {
bool operator<(const SelectionItem &b) const
{
if (this->messageIndex < b.messageIndex) {
return true;
}
if (this->messageIndex == b.messageIndex &&
this->charIndex < b.charIndex) {
return true;
}
return false;
return std::tie(this->messageIndex, this->charIndex) <
std::tie(b.messageIndex, b.charIndex);
}
bool operator>(const SelectionItem &b) const
{
return this->operator!=(b) && b.operator<(*this);
return b.operator<(*this);
}
bool operator==(const SelectionItem &b) const