mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 22:55:11 +00:00
Don't switch chats on ctrl+shift+send (support).
This commit is contained in:
@@ -2473,19 +2473,28 @@ not_null<const QTextEdit*> InputField::rawTextEdit() const {
|
||||
return _inner.get();
|
||||
}
|
||||
|
||||
bool InputField::ShouldSubmit(
|
||||
SubmitSettings settings,
|
||||
Qt::KeyboardModifiers modifiers) {
|
||||
const auto shift = modifiers.testFlag(Qt::ShiftModifier);
|
||||
const auto ctrl = modifiers.testFlag(Qt::ControlModifier)
|
||||
|| modifiers.testFlag(Qt::MetaModifier);
|
||||
return (ctrl && shift)
|
||||
|| (ctrl
|
||||
&& settings != SubmitSettings::None
|
||||
&& settings != SubmitSettings::Enter)
|
||||
|| (!ctrl
|
||||
&& !shift
|
||||
&& settings != SubmitSettings::None
|
||||
&& settings != SubmitSettings::CtrlEnter);
|
||||
}
|
||||
|
||||
void InputField::keyPressEventInner(QKeyEvent *e) {
|
||||
bool shift = e->modifiers().testFlag(Qt::ShiftModifier), alt = e->modifiers().testFlag(Qt::AltModifier);
|
||||
bool macmeta = (cPlatform() == dbipMac || cPlatform() == dbipMacOld) && e->modifiers().testFlag(Qt::ControlModifier) && !e->modifiers().testFlag(Qt::MetaModifier) && !e->modifiers().testFlag(Qt::AltModifier);
|
||||
bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier);
|
||||
bool enterSubmit = (_mode == Mode::SingleLine)
|
||||
|| (ctrl && shift)
|
||||
|| (ctrl
|
||||
&& _submitSettings != SubmitSettings::None
|
||||
&& _submitSettings != SubmitSettings::Enter)
|
||||
|| (!ctrl
|
||||
&& !shift
|
||||
&& _submitSettings != SubmitSettings::None
|
||||
&& _submitSettings != SubmitSettings::CtrlEnter);
|
||||
|| ShouldSubmit(_submitSettings, e->modifiers());
|
||||
bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return);
|
||||
if (e->key() == Qt::Key_Left
|
||||
|| e->key() == Qt::Key_Right
|
||||
|
@@ -267,6 +267,9 @@ public:
|
||||
|
||||
using SubmitSettings = InputSubmitSettings;
|
||||
void setSubmitSettings(SubmitSettings settings);
|
||||
static bool ShouldSubmit(
|
||||
SubmitSettings settings,
|
||||
Qt::KeyboardModifiers modifiers);
|
||||
void customUpDown(bool isCustom);
|
||||
void customTab(bool isCustom);
|
||||
int borderAnimationStart() const;
|
||||
|
Reference in New Issue
Block a user