Skip to content

Commit

Permalink
Merge branch 'master' into jeremypw/silence-some-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypw authored Feb 8, 2025
2 parents b84d5b4 + 46258fa commit d39525c
Show file tree
Hide file tree
Showing 618 changed files with 30,249 additions and 16,348 deletions.
354 changes: 354 additions & 0 deletions data/icons/48/open-project.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/io.elementary.code.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<file alias="scalable/actions/panel-right-symbolic.svg" compressed="true" preprocess="xml-stripblanks">icons/panel-right-symbolic.svg</file>
</gresource>
<gresource prefix="/io/elementary/code/icons">
<file alias="48x48/actions/open-project.svg" compressed="true" preprocess="xml-stripblanks">icons/48/open-project.svg</file>
<file alias="scalable/actions/filter-symbolic.svg" compressed="true" preprocess="xml-stripblanks">icons/filter-symbolic.svg</file>
<file alias="scalable/emblems/emblem-git-modified-symbolic.svg" compressed="true" preprocess="xml-stripblanks">icons/emblem-git-modified-symbolic.svg</file>
<file alias="scalable/emblems/emblem-git-new-symbolic.svg" compressed="true" preprocess="xml-stripblanks">icons/emblem-git-new-symbolic.svg</file>
Expand Down
5 changes: 5 additions & 0 deletions data/io.elementary.code.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
<summary>Remember the last focused document.</summary>
<description>Restore the focused document from a previous session when opening Code.</description>
</key>
<key name="active-project-path" type="s">
<default>''</default>
<summary>The active project path.</summary>
<description>The path to the folder containing the active project.</description>
</key>
<key name="default-build-directory" type="s">
<default>''</default>
<summary>The default build directory's relative path.</summary>
Expand Down
1 change: 1 addition & 0 deletions plugins/word-completion/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module_name = 'word-completion'

module_files = [
'prefix-tree.vala',
'prefix-tree-node.vala',
'completion-provider.vala',
'engine.vala',
'plugin.vala'
Expand Down
69 changes: 69 additions & 0 deletions plugins/word-completion/prefix-tree-node.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright 2024 elementary, Inc. <https://elementary.io>
* 2011 Lucas Baudin <[email protected]>
* *
* This is a free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; see the file COPYING. If not,
* write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

public class Scratch.Plugins.PrefixNode : Object {
public enum NodeType {
ROOT,
CHAR,
WORD_END
}

private const unichar WORD_END_CHAR = '\0';
private uint occurrences; // Only used for WORD_END nodes

public unichar uc { get; construct; }
public NodeType node_type { get; construct; }
public PrefixNode? parent { get; construct; }
public unichar value { get; construct; }

public Gee.ArrayList<PrefixNode> children;

public PrefixNode.from_unichar (unichar c, PrefixNode? _parent) requires (c != WORD_END_CHAR) {
Object (
value: c,
parent: _parent,
uc: c,
node_type: NodeType.CHAR
);
}

public PrefixNode.root () {
Object (
parent: null,
uc: WORD_END_CHAR,
node_type: NodeType.ROOT
);
}

public PrefixNode.word_end (PrefixNode _parent) {
Object (
parent: _parent,
uc: WORD_END_CHAR,
node_type: NodeType.WORD_END
);

occurrences = 1;
}

construct {
children = new Gee.ArrayList<PrefixNode> ();
}
}
20 changes: 4 additions & 16 deletions plugins/word-completion/prefix-tree.vala
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@

namespace Scratch.Plugins {
private class PrefixNode : Object {
public GLib.List<PrefixNode> children;
public unichar value { get; set; }

construct {
children = new List<PrefixNode> ();
}
}

public class PrefixTree : Object {
private PrefixNode root;

Expand All @@ -17,9 +8,7 @@ namespace Scratch.Plugins {
}

public void clear () {
root = new PrefixNode () {
value = '\0'
};
root = new PrefixNode ();
}

public void insert (string word) {
Expand Down Expand Up @@ -47,10 +36,9 @@ namespace Scratch.Plugins {
}
}

var new_child = new PrefixNode () {
value = curr
};
node.children.insert_sorted (new_child, (c1, c2) => {
var new_child = new PrefixNode.from_unichar (curr, null);
node.children.insert (0, new_child);
node.children.sort ((c1, c2) => {
if (c1.value > c2.value) {
return 1;
} else if (c1.value == c2.value) {
Expand Down
2 changes: 2 additions & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ src/Dialogs/GlobalSearchDialog.vala
src/Dialogs/NewBranchDialog.vala
src/Dialogs/PreferencesDialog.vala
src/Dialogs/RestoreConfirmationDialog.vala
src/Dialogs/CloseProjectsConfirmationDialog.vala
src/Dialogs/OverwriteUncommittedConfirmationDialog.vala
src/FolderManager/File.vala
src/FolderManager/FileItem.vala
src/FolderManager/FileView.vala
Expand Down
Loading

0 comments on commit d39525c

Please sign in to comment.