Skip to content

Commit 4c8604f

Browse files
authored
Merge branch 'master' into jeremypw/rework-highlight-selection2
2 parents fb4bf86 + 929a73a commit 4c8604f

File tree

7 files changed

+120
-65
lines changed

7 files changed

+120
-65
lines changed

po/extra/zh_TW.po

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ msgstr ""
88
"Project-Id-Version: scratch\n"
99
"Report-Msgid-Bugs-To: \n"
1010
"POT-Creation-Date: 2025-05-21 19:50+0000\n"
11-
"PO-Revision-Date: 2024-11-06 11:20+0000\n"
11+
"PO-Revision-Date: 2025-06-03 03:55+0000\n"
1212
"Last-Translator: Kisaragi Hiu <mail@kisaragi-hiu.com>\n"
13-
"Language-Team: Chinese (Traditional) <https://l10n.elementary.io/projects/"
14-
"code/extra/zh_Hant/>\n"
13+
"Language-Team: Chinese (Traditional Han script) <https://"
14+
"l10n.elementaryos.org/projects/code/extra/zh_Hant/>\n"
1515
"Language: zh_TW\n"
1616
"MIME-Version: 1.0\n"
1717
"Content-Type: text/plain; charset=UTF-8\n"
1818
"Content-Transfer-Encoding: 8bit\n"
1919
"Plural-Forms: nplurals=1; plural=0;\n"
20-
"X-Generator: Weblate 5.6.2\n"
20+
"X-Generator: Weblate 5.11.4\n"
2121
"X-Launchpad-Export-Date: 2017-05-03 06:04+0000\n"
2222

2323
#: data/code.metainfo.xml.in:9
@@ -127,10 +127,8 @@ msgid "Optional mini-map to make navigating large files easier"
127127
msgstr "可關閉的小地圖,讓瀏覽大檔案變得更容易"
128128

129129
#: data/code.metainfo.xml.in:65
130-
#, fuzzy
131-
#| msgid "elementary LLC."
132130
msgid "elementary, Inc."
133-
msgstr "elementary LLC."
131+
msgstr "elementary, Inc."
134132

135133
#: data/code.metainfo.xml.in:73 data/code.metainfo.xml.in:94
136134
#: data/code.metainfo.xml.in:123 data/code.metainfo.xml.in:162

po/ka.po

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ msgstr ""
33
"Project-Id-Version: PACKAGE VERSION\n"
44
"Report-Msgid-Bugs-To: \n"
55
"POT-Creation-Date: 2025-05-21 19:50+0000\n"
6-
"PO-Revision-Date: 2024-08-05 01:16+0000\n"
6+
"PO-Revision-Date: 2025-06-04 04:55+0000\n"
77
"Last-Translator: NorwayFun <temuri.doghonadze@gmail.com>\n"
8-
"Language-Team: Georgian <https://l10n.elementary.io/projects/code/code/ka/>\n"
8+
"Language-Team: Georgian <https://l10n.elementaryos.org/projects/code/code/ka/"
9+
">\n"
910
"Language: ka\n"
1011
"MIME-Version: 1.0\n"
1112
"Content-Type: text/plain; charset=UTF-8\n"
1213
"Content-Transfer-Encoding: 8bit\n"
1314
"Plural-Forms: nplurals=2; plural=n != 1;\n"
14-
"X-Generator: Weblate 5.6.2\n"
15+
"X-Generator: Weblate 5.11.4\n"
1516
"X-Launchpad-Export-Date: 2017-05-03 06:01+0000\n"
1617

1718
#: src/Application.vala:41 src/Widgets/DocumentView.vala:99
@@ -933,7 +934,7 @@ msgstr "ძებნის მორგება"
933934

934935
#: src/Widgets/SearchBar.vala:196
935936
msgid "Replace With"
936-
msgstr "ჩანაცვლება"
937+
msgstr "ჩანაცვლება რით"
937938

938939
#: src/Widgets/SearchBar.vala:199
939940
msgid "Replace"

po/zh_TW.po

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgstr ""
77
"Project-Id-Version: scratch\n"
88
"Report-Msgid-Bugs-To: \n"
99
"POT-Creation-Date: 2025-05-21 19:50+0000\n"
10-
"PO-Revision-Date: 2025-04-26 11:55+0000\n"
10+
"PO-Revision-Date: 2025-06-03 03:55+0000\n"
1111
"Last-Translator: Kisaragi Hiu <mail@kisaragi-hiu.com>\n"
1212
"Language-Team: Chinese (Traditional Han script) <https://"
1313
"l10n.elementaryos.org/projects/code/code/zh_Hant/>\n"
@@ -16,7 +16,7 @@ msgstr ""
1616
"Content-Type: text/plain; charset=UTF-8\n"
1717
"Content-Transfer-Encoding: 8bit\n"
1818
"Plural-Forms: nplurals=1; plural=0;\n"
19-
"X-Generator: Weblate 5.10.4\n"
19+
"X-Generator: Weblate 5.11.4\n"
2020
"X-Launchpad-Export-Date: 2017-05-03 06:04+0000\n"
2121

2222
#: src/Application.vala:41 src/Widgets/DocumentView.vala:99
@@ -649,16 +649,13 @@ msgid "Too Many Symbols"
649649
msgstr "太多符號"
650650

651651
#: src/SymbolPane/Vala/ValaSymbolOutline.vala:124
652-
#, fuzzy, c-format
653-
#| msgid ""
654-
#| "%s contains too many Vala symbols.\n"
655-
#| "Parsing and showing them took long"
652+
#, c-format
656653
msgid ""
657654
"%s contains too many Vala symbols.\n"
658655
"Parsing and showing them took too long."
659656
msgstr ""
660657
"%s 內含太多 Vala 符號。\n"
661-
"剖析與顯示它們花了很多時間"
658+
"剖析與顯示它們花了太多時間。"
662659

663660
#: src/SymbolPane/SymbolOutline.vala:35
664661
msgid "Class"
@@ -940,20 +937,16 @@ msgid "Sort Selected Lines"
940937
msgstr "排序所選取的行"
941938

942939
#: src/Widgets/SourceView.vala:596
943-
#, fuzzy
944-
#| msgid "Current Line"
945940
msgid "Mark Current Line"
946-
msgstr "目前的行"
941+
msgstr "標記目前的行"
947942

948943
#: src/Widgets/SourceView.vala:607
949944
msgid "Goto Previous Edit Mark"
950-
msgstr ""
945+
msgstr "前往上一個編輯標記"
951946

952947
#: src/Widgets/SourceView.vala:618
953-
#, fuzzy
954-
#| msgid "Text Editor"
955948
msgid "Goto Next Edit Mark"
956-
msgstr "文字編輯器"
949+
msgstr "前往下一個編輯標記"
957950

958951
#: src/Widgets/SourceView.vala:637
959952
msgid "Toggle Comment"

src/FolderManager/FileView.vala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
209209
}
210210
}
211211

212-
private unowned Code.Widgets.SourceList.Item? find_path (Code.Widgets.SourceList.ExpandableItem list,
213-
string path,
214-
bool expand = false) {
212+
private unowned Code.Widgets.SourceList.Item? find_path (
213+
Code.Widgets.SourceList.ExpandableItem list,
214+
string path,
215+
bool expand = false) {
216+
215217
foreach (var item in list.children) {
216218
if (item is Item) {
217219
var code_item = (Item)item;
@@ -227,6 +229,7 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
227229

228230
if (!expander.expanded) {
229231
if (expand) {
232+
((FolderItem)expander).load_children (); //Synchronous
230233
expander.expanded = true;
231234
} else {
232235
continue;

src/FolderManager/FolderItem.vala

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ namespace Scratch.FolderManager {
2929
private bool has_dummy;
3030
private Code.Widgets.SourceList.Item dummy; /* Blank item for expanded empty folders */
3131

32+
public bool loading_required {
33+
get {
34+
return !children_loaded && n_children <= 1 && file.children.size > 0;
35+
}
36+
}
37+
3238
public FolderItem (File file, FileView view) {
3339
Object (file: file, view: view);
3440
}
@@ -55,50 +61,65 @@ namespace Scratch.FolderManager {
5561
}
5662
}
5763

58-
private async void load_children () {
59-
var root = get_root_folder ();
60-
foreach (var child in file.children) {
61-
Idle.add (() => {
62-
Code.Widgets.SourceList.Item item = null;
63-
if (child.is_valid_directory) {
64-
item = new FolderItem (child, view);
65-
} else if (child.is_valid_textfile) {
66-
item = new FileItem (child, view);
67-
}
68-
69-
if (item != null) {
70-
add (item);
71-
}
72-
73-
load_children.callback ();
74-
return Source.REMOVE;
75-
});
76-
77-
yield;
64+
65+
public void load_children () {
66+
if (loading_required) {
67+
foreach (var child in file.children) {
68+
add_child (child);
69+
}
70+
71+
after_children_loaded ();
7872
}
73+
}
7974

80-
children_loaded = true;
81-
if (root != null) {
82-
root.child_folder_loaded (this);
75+
private async void load_children_async () {
76+
if (loading_required) {
77+
foreach (var child in file.children) {
78+
Idle.add (() => {
79+
add_child (child);
80+
load_children_async.callback ();
81+
return Source.REMOVE;
82+
});
83+
84+
yield;
85+
}
8386
}
87+
88+
after_children_loaded ();
8489
}
8590

86-
private void on_toggled () {
87-
if (!children_loaded &&
88-
expanded &&
89-
n_children <= 1 &&
90-
file.children.size > 0) {
91+
private void add_child (File child) {
92+
Code.Widgets.SourceList.Item item = null;
93+
if (child.is_valid_directory) {
94+
item = new FolderItem (child, view);
95+
} else if (child.is_valid_textfile) {
96+
item = new FileItem (child, view);
97+
}
9198

92-
load_children.begin ();
93-
return;
99+
if (item != null) {
100+
add (item);
94101
}
102+
}
95103

104+
private void after_children_loaded () {
105+
children_loaded = true;
96106
var root = get_root_folder ();
97-
if (!expanded &&
98-
root != null &&
99-
root.monitored_repo != null) {
100-
//When toggled closed, update status to reflect hidden contents
101-
root.update_item_status (this);
107+
if (root != null) {
108+
root.child_folder_loaded (this); //Updates child status emblens
109+
}
110+
}
111+
112+
private void on_toggled () {
113+
if (expanded) {
114+
load_children_async.begin ();
115+
return;
116+
} else {
117+
var root = get_root_folder ();
118+
if (root != null &&
119+
root.monitored_repo != null) {
120+
//When toggled closed, update status to reflect hidden contents
121+
root.update_item_status (this);
122+
}
102123
}
103124
}
104125

src/MainWindow.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ namespace Scratch {
304304
plugins = new Scratch.Services.PluginsManager (this);
305305

306306
key_controller = new Gtk.EventControllerKey (this) {
307-
propagation_phase = CAPTURE
307+
propagation_phase = TARGET
308308
};
309309
key_controller.key_pressed.connect (on_key_pressed);
310310

src/Widgets/Terminal.vala

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public class Code.Terminal : Gtk.Box {
1616
private const string SETTINGS_SCHEMA = "io.elementary.terminal.settings";
1717

1818
public Vte.Terminal terminal { get; construct; }
19+
private Gtk.EventControllerKey key_controller;
20+
private Settings pantheon_terminal_settings;
21+
1922
public SimpleActionGroup actions { get; construct; }
2023

2124
private GLib.Pid child_pid;
@@ -63,6 +66,11 @@ public class Code.Terminal : Gtk.Box {
6366
menu.insert_action_group (ACTION_GROUP, actions);
6467
menu.show_all ();
6568

69+
key_controller = new Gtk.EventControllerKey (terminal) {
70+
propagation_phase = BUBBLE
71+
};
72+
key_controller.key_pressed.connect (key_pressed);
73+
6674
terminal.button_press_event.connect ((event) => {
6775
if (event.button == 3) {
6876
paste_action.set_enabled (current_clipboard.wait_is_text_available ());
@@ -130,7 +138,7 @@ public class Code.Terminal : Gtk.Box {
130138
}
131139

132140
private void update_terminal_settings (string settings_schema) {
133-
var pantheon_terminal_settings = new GLib.Settings (settings_schema);
141+
pantheon_terminal_settings = new GLib.Settings (settings_schema);
134142

135143
var font_name = pantheon_terminal_settings.get_string ("font");
136144
if (font_name == "") {
@@ -207,4 +215,35 @@ public class Code.Terminal : Gtk.Box {
207215
public void set_default_font_size () {
208216
terminal.font_scale = 1.0;
209217
}
218+
219+
private bool key_pressed (uint keyval, uint keycode, Gdk.ModifierType modifiers) {
220+
// Use hardware keycodes so the key used is unaffected by internationalized layout
221+
bool match_keycode (uint keyval, uint code) {
222+
Gdk.KeymapKey[] keys;
223+
224+
var keymap = Gdk.Keymap.get_for_display (get_display ());
225+
if (keymap.get_entries_for_keyval (keyval, out keys)) {
226+
foreach (var key in keys) {
227+
if (code == key.keycode) {
228+
return Gdk.EVENT_STOP;
229+
}
230+
}
231+
}
232+
233+
return Gdk.EVENT_PROPAGATE;
234+
}
235+
236+
if (CONTROL_MASK in modifiers && pantheon_terminal_settings.get_boolean ("natural-copy-paste")) {
237+
if (match_keycode (Gdk.Key.c, keycode) && terminal.get_has_selection ()) {
238+
actions.activate_action (ACTION_COPY, null);
239+
return Gdk.EVENT_STOP;
240+
} else if (match_keycode (Gdk.Key.v, keycode) && current_clipboard.wait_is_text_available ()) {
241+
actions.activate_action (ACTION_PASTE, null);
242+
return Gdk.EVENT_STOP;
243+
}
244+
}
245+
246+
247+
return Gdk.EVENT_PROPAGATE;
248+
}
210249
}

0 commit comments

Comments
 (0)