Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Services/Document.vala
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,19 @@ namespace Scratch.Services {
completion_shown = false;
});

source_view.enter_notify_event.connect (() => {
if (!source_view.has_focus) {
source_view.grab_focus ();
}
});

source_view.focus_out_event.connect (() => {
if (Scratch.settings.get_boolean ("strip-trailing-on-save")) {

strip_trailing_spaces ();
}
});

loaded = file == null;

add (main_stack);
Expand Down
8 changes: 8 additions & 0 deletions src/Widgets/Terminal.vala
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ public class Code.Terminal : Gtk.Box {
};
key_controller.key_pressed.connect (key_pressed);

// Cannot use event controller in Gtk3 because of https://gitlab.gnome.org/GNOME/gtk/-/issues/7225
terminal.enter_notify_event.connect (() => {
if (!terminal.has_focus) {
terminal.grab_focus ();

}
});

terminal.button_press_event.connect ((event) => {
if (event.button == 3) {
paste_action.set_enabled (current_clipboard.wait_is_text_available ());
Expand Down