Skip to content

Commit 5105705

Browse files
committed
Merge branch 'master' into jeremypw/separate-terminal-zoom
# Conflicts: # src/MainWindow.vala # src/Widgets/Terminal.vala
2 parents 1592a38 + 3f75045 commit 5105705

639 files changed

Lines changed: 54059 additions & 54766 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎data/code.metainfo.xml.in‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@
6868
<update_contact>contact_AT_elementary.io</update_contact>
6969

7070
<releases>
71+
<release version="8.3.2" date="2026-08-04" urgency="medium">
72+
<description>
73+
<p>Minor updates:</p>
74+
<ul>
75+
<li>Updated translations</li>
76+
</ul>
77+
</description>
78+
<issues>
79+
<issue url="https://github.com/elementary/code/issues/851">Word completion retains deleted words</issue>
80+
<issue url="https://github.com/elementary/code/issues/1527">Word completion omits first word in document until refreshed</issue>
81+
<issue url="https://github.com/elementary/code/issues/1737">Changing pane visibility in one window affects all windows</issue>
82+
<issue url="https://github.com/elementary/code/issues/1750">Code uses system document font instead of monospace font by default</issue>
83+
</issues>
84+
</release>
85+
7186
<release version="8.3.1" date="2026-06-19" urgency="medium">
7287
<description>
7388
<p>Improvements:</p>

‎meson.build‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ project(
22
'io.elementary.code',
33
'vala', 'c',
44
meson_version: '>= 0.58.0',
5-
version: '8.3.1'
5+
version: '8.3.2'
66
)
77

88
add_project_arguments([

‎plugins/brackets-completion/brackets-completion.vala‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Se
1111

1212
public Object object { owned get; set construct; }
1313

14+
private Gtk.EventControllerKey key_controller;
1415
private Gee.HashMap<string, string> brackets;
1516
private Gee.HashMap<uint, string> keys;
1617
private Gtk.TextBuffer current_buffer;
@@ -40,6 +41,12 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Se
4041

4142
plugins = (Scratch.Services.Interface) object;
4243
plugins.hook_document.connect (on_hook_document);
44+
plugins.hook_window.connect ((w) => {
45+
key_controller = new Gtk.EventControllerKey (w) {
46+
propagation_phase = CAPTURE
47+
};
48+
key_controller.key_pressed.connect (on_key_down);
49+
});
4350
}
4451

4552
public void deactivate () {
@@ -52,14 +59,12 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Se
5259
current_buffer = doc.source_view.buffer;
5360

5461
if (current_source_view != null) {
55-
current_source_view.key_press_event.disconnect (on_key_down);
5662
current_source_view.event_after.disconnect (on_event_after);
5763
current_source_view.backspace.disconnect (on_backspace);
5864
}
5965

6066
current_source_view = doc.source_view;
6167

62-
current_source_view.key_press_event.connect (on_key_down);
6368
current_source_view.event_after.connect (on_event_after);
6469
current_source_view.backspace.connect (on_backspace);
6570
}
@@ -163,8 +168,17 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Se
163168
current_buffer.end_user_action ();
164169
}
165170

166-
private bool on_key_down (Gdk.EventKey event) {
167-
if (Gdk.ModifierType.MOD1_MASK in event.state || Gdk.ModifierType.CONTROL_MASK in event.state) {
171+
private bool on_key_down (
172+
uint keyval,
173+
uint keycode,
174+
Gdk.ModifierType state
175+
) requires (current_source_view != null && current_buffer != null) {
176+
177+
if (!current_source_view.is_focus) {
178+
return false;
179+
}
180+
181+
if (Gdk.ModifierType.MOD1_MASK in state || Gdk.ModifierType.CONTROL_MASK in state) {
168182
return false;
169183
}
170184

@@ -173,7 +187,7 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Se
173187
return false;
174188
}
175189

176-
if (keys.has_key (event.keyval) && current_buffer.has_selection) {
190+
if (keys.has_key (keyval) && current_buffer.has_selection) {
177191
Gtk.TextIter start, end;
178192
current_buffer.get_selection_bounds (out start, out end);
179193

‎plugins/fuzzy-search/fuzzy-search-popover.vala‎

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
*/
88

99
public class Scratch.FuzzySearchPopover : Gtk.Popover {
10+
public signal void open_file (string filepath);
11+
public signal void close_search ();
12+
13+
public Scratch.MainWindow current_window { get; construct; }
14+
public Scratch.Services.FuzzySearchIndexer search_indexer { get; construct; }
15+
public bool sidebar_is_visible { get; set; }
16+
1017
private Gtk.SearchEntry search_term_entry;
1118
private Services.FuzzyFinder fuzzy_finder;
1219
private Gtk.ListBox search_result_container;
@@ -20,12 +27,6 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
2027
private Gtk.EventControllerKey search_term_entry_key_controller;
2128
private Gtk.Label title_label;
2229
private string current_doc_project;
23-
public Scratch.MainWindow current_window { get; construct; }
24-
public Scratch.Services.FuzzySearchIndexer search_indexer { get; construct; }
25-
public bool sidebar_is_visible { get; set; }
26-
27-
public signal void open_file (string filepath);
28-
public signal void close_search ();
2930

3031
public FuzzySearchPopover (Scratch.Services.FuzzySearchIndexer search_indexer, Scratch.MainWindow window) {
3132
Object (
@@ -34,58 +35,54 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
3435
);
3536
}
3637

37-
private void calculate_scroll_offset (int old_position, int new_position) {
38-
// Shortcut if jumping from first to last or the other way round
39-
if (new_position == 0 && old_position > new_position) {
40-
scrolled.vadjustment.value = 0;
41-
return;
42-
} else if (old_position == 0 && new_position == items.size - 1) {
43-
scrolled.vadjustment.value = scrolled.vadjustment.get_upper ();
44-
return;
45-
}
46-
47-
var size_box = scrolled.vadjustment.get_upper () / items.size;
48-
var current_top = scrolled.vadjustment.value;
49-
var current_bottom = current_top + size_box * (max_items - 2);
50-
if (old_position < new_position) {
51-
// Down movement
52-
var new_adjust = size_box * (preselected_index);
53-
if (new_adjust >= current_bottom) {
54-
scrolled.vadjustment.value = size_box * (preselected_index - (max_items - 1));
55-
}
56-
} else if (old_position > new_position) {
57-
// Up movement
58-
var new_adjust = size_box * (preselected_index);
59-
if (new_adjust < current_top) {
60-
scrolled.vadjustment.value = new_adjust;
61-
}
62-
}
63-
}
64-
6538
construct {
6639
modal = true;
6740
relative_to = current_window.document_view;
6841
width_request = 500;
6942
pointing_to = { 0, 32, 1, 1 };
43+
get_style_context ().add_class ("fuzzy-popover");
7044

71-
this.get_style_context ().add_class ("fuzzy-popover");
45+
title_label = new Granite.HeaderLabel (_("Find project files"));
7246

73-
title_label = new Gtk.Label (_("Find project files"));
74-
title_label.halign = Gtk.Align.START;
75-
title_label.get_style_context ().add_class ("h4");
76-
77-
search_term_entry = new Gtk.SearchEntry ();
78-
search_term_entry.halign = Gtk.Align.FILL;
79-
search_term_entry.hexpand = true;
47+
search_term_entry = new Gtk.SearchEntry () {
48+
hexpand = true,
49+
valign = START
50+
};
8051

8152
search_result_container = new Gtk.ListBox () {
82-
selection_mode = Gtk.SelectionMode.NONE,
53+
selection_mode = NONE,
8354
activate_on_single_click = true,
8455
can_focus = false
8556
};
86-
8757
search_result_container.get_style_context ().add_class ("fuzzy-list");
8858

59+
var entry_layout = new Gtk.Box (VERTICAL, 0) {
60+
valign = START
61+
};
62+
entry_layout.add (title_label);
63+
entry_layout.add (search_term_entry);
64+
65+
scrolled = new Gtk.ScrolledWindow (null, null) {
66+
propagate_natural_height = true,
67+
hexpand = true,
68+
vexpand = true,
69+
child = search_result_container
70+
};
71+
72+
var box = new Gtk.Box (VERTICAL, 0);
73+
box.add (entry_layout);
74+
box.add (scrolled);
75+
box.show_all ();
76+
77+
scrolled.hide ();
78+
79+
add (box);
80+
81+
fuzzy_finder = new Services.FuzzyFinder (search_indexer.project_paths);
82+
indexer = search_indexer;
83+
items = new Gee.ArrayList<FileItem> ();
84+
cancellables = new Gee.LinkedList<GLib.Cancellable> ();
85+
8986
search_result_container.row_activated.connect ((row) => {
9087
var file_item = row as FileItem;
9188
if (file_item == null) {
@@ -225,33 +222,6 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
225222
}
226223
});
227224

228-
var entry_layout = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
229-
entry_layout.valign = Gtk.Align.START;
230-
231-
entry_layout.add (title_label);
232-
entry_layout.add (search_term_entry);
233-
search_term_entry.valign = Gtk.Align.START;
234-
235-
scrolled = new Gtk.ScrolledWindow (null, null) {
236-
propagate_natural_height = true,
237-
hexpand = true
238-
};
239-
240-
scrolled.add (search_result_container);
241-
242-
var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
243-
box.pack_start (entry_layout, false, false);
244-
box.pack_end (scrolled, true, true);
245-
box.show_all ();
246-
247-
scrolled.hide ();
248-
this.add (box);
249-
250-
fuzzy_finder = new Services.FuzzyFinder (search_indexer.project_paths);
251-
indexer = search_indexer;
252-
items = new Gee.ArrayList<FileItem> ();
253-
cancellables = new Gee.LinkedList<GLib.Cancellable> ();
254-
255225
search_term_entry.realize.connect_after (() => {
256226
int height;
257227
current_window.get_size (null, out height);
@@ -286,6 +256,34 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
286256
});
287257
}
288258

259+
private void calculate_scroll_offset (int old_position, int new_position) {
260+
// Shortcut if jumping from first to last or the other way round
261+
if (new_position == 0 && old_position > new_position) {
262+
scrolled.vadjustment.value = 0;
263+
return;
264+
} else if (old_position == 0 && new_position == items.size - 1) {
265+
scrolled.vadjustment.value = scrolled.vadjustment.get_upper ();
266+
return;
267+
}
268+
269+
var size_box = scrolled.vadjustment.get_upper () / items.size;
270+
var current_top = scrolled.vadjustment.value;
271+
var current_bottom = current_top + size_box * (max_items - 2);
272+
if (old_position < new_position) {
273+
// Down movement
274+
var new_adjust = size_box * (preselected_index);
275+
if (new_adjust >= current_bottom) {
276+
scrolled.vadjustment.value = size_box * (preselected_index - (max_items - 1));
277+
}
278+
} else if (old_position > new_position) {
279+
// Up movement
280+
var new_adjust = size_box * (preselected_index);
281+
if (new_adjust < current_top) {
282+
scrolled.vadjustment.value = new_adjust;
283+
}
284+
}
285+
}
286+
289287
private void handle_item_selection (int index) {
290288
var item = items.get (index);
291289
open_file (item.filepath.strip ());

‎plugins/markdown-actions/markdown-actions.vala‎

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services
2727

2828
public void update_state () {}
2929

30+
private Gtk.EventControllerKey key_controller;
31+
private bool is_markdown = false;
32+
3033
public void activate () {
3134
plugins = (Scratch.Services.Interface) object;
3235
plugins.hook_document.connect ((doc) => {
3336
if (current_source != null) {
34-
current_source.key_press_event.disconnect (shortcut_handler);
3537
current_source.notify["language"].disconnect (configure_shortcuts);
3638
}
3739

@@ -40,30 +42,44 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services
4042

4143
current_source.notify["language"].connect (configure_shortcuts);
4244
});
45+
plugins.hook_window.connect ((w) => {
46+
key_controller = new Gtk.EventControllerKey (w) {
47+
propagation_phase = CAPTURE
48+
};
49+
key_controller.key_pressed.connect (shortcut_handler);
50+
});
4351
}
4452

4553
private void configure_shortcuts () {
4654
var lang = current_source.language;
47-
if (lang != null && lang.id == "markdown") {
48-
current_source.key_press_event.connect (shortcut_handler);
49-
} else {
50-
current_source.key_press_event.disconnect (shortcut_handler);
51-
}
55+
is_markdown = (lang != null && lang.id == "markdown");
5256
}
5357

54-
private bool shortcut_handler (Gdk.EventKey evt) {
55-
var control = (evt.state & Gdk.ModifierType.CONTROL_MASK) != 0;
56-
var shift = (evt.state & Gdk.ModifierType.SHIFT_MASK) != 0;
57-
var other_mods = (evt.state & Gtk.accelerator_get_default_mod_mask () &
58-
~Gdk.ModifierType.SHIFT_MASK &
59-
~Gdk.ModifierType.CONTROL_MASK) != 0;
58+
private bool shortcut_handler (
59+
Gtk.EventController controller,
60+
uint keyval,
61+
uint keycode,
62+
Gdk.ModifierType state
63+
) requires (current_source != null) {
6064

61-
if (evt.is_modifier == 1 || other_mods == true) {
65+
if (!current_source.is_focus) {
6266
return false;
6367
}
6468

69+
if (!is_markdown || !Gtk.accelerator_valid (keyval, state)) {
70+
return false;
71+
}
72+
73+
var mods = (state & Gtk.accelerator_get_default_mod_mask ());
74+
if (((mods & ~Gdk.ModifierType.SHIFT_MASK) & ~Gdk.ModifierType.CONTROL_MASK) != 0) {
75+
// A modifier other than Control or Shift is down
76+
return false;
77+
}
78+
79+
var control = (mods & Gdk.ModifierType.CONTROL_MASK) != 0;
80+
var shift = (mods & Gdk.ModifierType.SHIFT_MASK) != 0;
6581
if (control && shift) {
66-
switch (evt.keyval) {
82+
switch (keyval) {
6783
case Gdk.Key.B:
6884
add_markdown_tag ("**");
6985
return true;
@@ -76,7 +92,7 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services
7692
}
7793
}
7894

79-
if (evt.keyval == Gdk.Key.Return) {
95+
if (keyval == Gdk.Key.Return) {
8096
char ul_marker;
8197
int ol_number = 1;
8298
string item_text;
@@ -100,6 +116,7 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services
100116
return true;
101117
}
102118
}
119+
103120
return false;
104121
}
105122

@@ -234,7 +251,6 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services
234251

235252
public void deactivate () {
236253
if (current_source != null) {
237-
current_source.key_press_event.disconnect (shortcut_handler);
238254
current_source.notify["language"].disconnect (configure_shortcuts);
239255
}
240256
}

0 commit comments

Comments
 (0)