Skip to content

Commit

Permalink
clear input when exiting editing
Browse files Browse the repository at this point in the history
  • Loading branch information
ouwou committed Jul 15, 2023
1 parent 00524ce commit f941ad1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/chatinput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,10 @@ void ChatInput::InsertText(const Glib::ustring &text) {
m_input.Get().InsertText(text);
}

void ChatInput::Clear() {
GetBuffer()->set_text("");
}

Glib::RefPtr<Gtk::TextBuffer> ChatInput::GetBuffer() {
return m_input.Get().GetBuffer();
}
Expand Down
1 change: 1 addition & 0 deletions src/components/chatinput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class ChatInput : public Gtk::Box {
ChatInput();

void InsertText(const Glib::ustring &text);
void Clear();
Glib::RefPtr<Gtk::TextBuffer> GetBuffer();
bool ProcessKeyPress(GdkEventKey *event);
void AddAttachment(const Glib::RefPtr<Gio::File> &file);
Expand Down
1 change: 1 addition & 0 deletions src/components/chatwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ void ChatWindow::StopEditing() {
m_is_editing = false;
m_editing_id = Snowflake::Invalid;
m_input->StopEditing();
m_input->Clear();
m_input_indicator->ClearCustom();
}

Expand Down

0 comments on commit f941ad1

Please sign in to comment.