mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fixed not being able to select text backwards
This commit is contained in:
parent
c768bd9bd9
commit
63eaf3b94c
|
@ -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
|
||||
|
|
|
@ -78,6 +78,16 @@ const QString &TwitchAccount::getUserId() const
|
|||
return this->userId_;
|
||||
}
|
||||
|
||||
QColor TwitchAccount::color()
|
||||
{
|
||||
return this->color_.get();
|
||||
}
|
||||
|
||||
void TwitchAccount::setColor(QColor color)
|
||||
{
|
||||
this->color_.set(color);
|
||||
}
|
||||
|
||||
bool TwitchAccount::setOAuthClient(const QString &newClientID)
|
||||
{
|
||||
if (this->oauthClient_.compare(newClientID) == 0) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "common/Atomic.hpp"
|
||||
#include "common/UniqueAccess.hpp"
|
||||
#include "controllers/accounts/Account.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
|
@ -66,9 +67,11 @@ public:
|
|||
const QString &getUserName() const;
|
||||
const QString &getOAuthToken() const;
|
||||
const QString &getOAuthClient() const;
|
||||
|
||||
const QString &getUserId() const;
|
||||
|
||||
QColor color();
|
||||
void setColor(QColor color);
|
||||
|
||||
// Attempts to update the users OAuth Client ID
|
||||
// Returns true if the value has changed, otherwise false
|
||||
bool setOAuthClient(const QString &newClientID);
|
||||
|
@ -104,8 +107,6 @@ public:
|
|||
void loadEmotes();
|
||||
AccessGuard<const TwitchAccountEmoteData> accessEmotes() const;
|
||||
|
||||
QColor color;
|
||||
|
||||
private:
|
||||
void parseEmotes(const rapidjson::Document &document);
|
||||
void loadEmoteSetData(std::shared_ptr<EmoteSet> emoteSet);
|
||||
|
@ -115,6 +116,7 @@ private:
|
|||
QString userName_;
|
||||
QString userId_;
|
||||
const bool isAnon_;
|
||||
Atomic<QColor> color_;
|
||||
|
||||
mutable std::mutex ignoresMutex_;
|
||||
std::set<TwitchUser> ignores_;
|
||||
|
|
|
@ -457,7 +457,7 @@ void TwitchMessageBuilder::appendUsername()
|
|||
app->themes->messages.textColors.system,
|
||||
FontStyle::ChatMedium);
|
||||
|
||||
QColor selfColor = currentUser->color;
|
||||
QColor selfColor = currentUser->color();
|
||||
if (!selfColor.isValid()) {
|
||||
selfColor = app->themes->messages.textColors.system;
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ void TwitchMessageBuilder::parseHighlights(bool isPastMsg)
|
|||
QString currentUsername = currentUser->getUserName();
|
||||
|
||||
if (this->ircMessage->nick() == currentUsername) {
|
||||
currentUser->color = this->usernameColor_;
|
||||
currentUser->setColor(this->usernameColor_);
|
||||
// Do nothing. Highlights cannot be triggered by yourself
|
||||
return;
|
||||
}
|
||||
|
@ -645,8 +645,7 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
|
|||
flags = MessageElementFlag::BttvEmote;
|
||||
} else if ((emote = getApp()->emotes->ffz.global(name))) {
|
||||
flags = MessageElementFlag::FfzEmote;
|
||||
} else if (twitchChannel &&
|
||||
(emote = this->twitchChannel->ffzEmote(name))) {
|
||||
} else if (twitchChannel && (emote = this->twitchChannel->ffzEmote(name))) {
|
||||
flags = MessageElementFlag::FfzEmote;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue