Skip to content

Commit

Permalink
Fix selection clearing not working in Reply window (#4218)
Browse files Browse the repository at this point in the history
Co-authored-by: Rasmus Karlsson <[email protected]>
  • Loading branch information
kornes and pajlada authored Dec 7, 2022
1 parent e68a3fc commit a16d148
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Bugfix: Fixed CTRL + C not working in reply thread popups. (#4209)
- Bugfix: Fixed message input showing as red after removing a message that was more than 500 characters. (#4204)
- Bugfix: Fixed unnecessary saving of windows layout. (#4201)
- Bugfix: Fixed Reply window missing selection clear behaviour between chat and input box. (#4218)
- Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198)

## 2.4.0
Expand Down
16 changes: 16 additions & 0 deletions src/widgets/dialogs/ReplyThreadPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, QWidget *parent,
this->updateInputUI();
}));

// clear SplitInput selection when selecting in ChannelView
this->ui_.threadView->selectionChanged.connect([this]() {
if (this->ui_.replyInput->hasSelection())
{
this->ui_.replyInput->clearSelection();
}
});

// clear ChannelView selection when selecting in SplitInput
this->ui_.replyInput->selectionChanged.connect([this]() {
if (this->ui_.threadView->hasSelection())
{
this->ui_.threadView->clearSelection();
}
});

layout->setSpacing(0);
// provide draggable margin if frameless
auto marginPx = closeAutomatically ? 15 : 1;
Expand Down
9 changes: 9 additions & 0 deletions src/widgets/splits/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,22 @@ Split::Split(QWidget *parent)
});
this->updateInputPlaceholder();

// clear SplitInput selection when selecting in ChannelView
this->view_->selectionChanged.connect([this]() {
if (this->input_->hasSelection())
{
this->input_->clearSelection();
}
});

// clear ChannelView selection when selecting in SplitInput
this->input_->selectionChanged.connect([this]() {
if (this->view_->hasSelection())
{
this->view_->clearSelection();
}
});

this->view_->openChannelIn.connect([this](
QString twitchChannel,
FromTwitchLinkOpenChannelIn openIn) {
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/splits/SplitInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ void SplitInput::initLayout()
this->clearInput();
});

// clear channelview selection when selecting in the input
// Forward selection change signal
QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable,
[this](bool available) {
if (available)
{
this->split_->view_->clearSelection();
this->selectionChanged.invoke();
}
});

Expand Down
1 change: 1 addition & 0 deletions src/widgets/splits/SplitInput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class SplitInput : public BaseWidget
bool isHidden() const;

pajlada::Signals::Signal<const QString &> textChanged;
pajlada::Signals::NoArgSignal selectionChanged;

protected:
void scaleChangedEvent(float scale_) override;
Expand Down

0 comments on commit a16d148

Please sign in to comment.