mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-06 20:15:19 +03:00
only start editing if input is empty
This commit is contained in:
@@ -579,6 +579,10 @@ void ChatInput::StopEditing() {
|
||||
m_input.Get().get_style_context()->remove_class("editing");
|
||||
}
|
||||
|
||||
bool ChatInput::IsEmpty() {
|
||||
return GetBuffer()->get_char_count() == 0;
|
||||
}
|
||||
|
||||
bool ChatInput::AddFileAsImageAttachment(const Glib::RefPtr<Gio::File> &file) {
|
||||
try {
|
||||
const auto read_stream = file->read();
|
||||
|
||||
@@ -143,6 +143,8 @@ public:
|
||||
void StartEditing(const Message &message);
|
||||
void StopEditing();
|
||||
|
||||
bool IsEmpty();
|
||||
|
||||
private:
|
||||
bool AddFileAsImageAttachment(const Glib::RefPtr<Gio::File> &file);
|
||||
bool CanAttachFiles();
|
||||
|
||||
@@ -287,7 +287,7 @@ bool ChatWindow::OnInputSubmit(ChatSubmitParams data) {
|
||||
|
||||
bool ChatWindow::ProcessKeyEvent(GdkEventKey *e) {
|
||||
if (e->type != GDK_KEY_PRESS) return false;
|
||||
if (e->keyval == GDK_KEY_Up) {
|
||||
if (e->keyval == GDK_KEY_Up && !(e->state & GDK_SHIFT_MASK) && m_input->IsEmpty()) {
|
||||
const auto edit_id = m_chat->GetLastSentMessage();
|
||||
if (edit_id.has_value()) {
|
||||
StartEditing(*edit_id);
|
||||
|
||||
Reference in New Issue
Block a user