Skip to content

Commit bd59edd

Browse files
authored
Disable-able Syntax Highlighting Preference (#1664)
1 parent a398925 commit bd59edd

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

data/io.elementary.code.gschema.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@
106106
<summary>Highlight Matching Brackets</summary>
107107
<description>Whether Code should highlight matching brackets.</description>
108108
</key>
109+
<key name="syntax-highlighting" type="b">
110+
<default>true</default>
111+
<summary>Highlight source code syntax</summary>
112+
<description>Whether Code should apply syntax highlighting to documents.</description>
113+
</key>
109114
<key name="draw-spaces" enum="io.elementary.code.draw-spaces-states">
110115
<default>"For Selection"</default>
111116
<summary>Draw spaces and tabs with symbols</summary>

src/Dialogs/PreferencesDialog.vala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public class Scratch.Dialogs.Preferences : Granite.Dialog {
110110
var editor_box = new Gtk.Box (VERTICAL, 12);
111111
editor_box.add (new Granite.HeaderLabel (_("Editor")));
112112
editor_box.add (new SettingSwitch (_("Highlight matching brackets"), "highlight-matching-brackets"));
113+
editor_box.add (new SettingSwitch (_("Syntax highlighting"), "syntax-highlighting"));
113114
editor_box.add (draw_spaces_box);
114115
editor_box.add (new SettingSwitch (_("Mini Map"), "show-mini-map"));
115116
editor_box.add (new SettingSwitch (_("Wrap lines"), "line-wrap"));

src/Widgets/FormatBar.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class Code.FormatBar : Gtk.Box {
4747

4848
lang_menubutton = new FormatButton () {
4949
icon = new ThemedIcon ("application-x-class-file-symbolic"),
50-
tooltip_text = _("Syntax Highlighting")
50+
tooltip_text = _("Document language")
5151
};
5252

5353
line_menubutton = new FormatButton () {

src/Widgets/SourceView.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ namespace Scratch.Widgets {
9595

9696
var source_buffer = new Gtk.SourceBuffer (null);
9797
set_buffer (source_buffer);
98-
source_buffer.highlight_syntax = true;
98+
source_buffer.highlight_syntax = Scratch.settings.get_boolean ("syntax-highlighting");
9999
source_buffer.mark_set.connect (on_mark_set);
100100
source_buffer.mark_deleted.connect (on_mark_deleted);
101101
highlight_current_line = true;
@@ -239,6 +239,7 @@ namespace Scratch.Widgets {
239239
insert_spaces_instead_of_tabs = Scratch.settings.get_boolean ("spaces-instead-of-tabs");
240240
var source_buffer = (Gtk.SourceBuffer) buffer;
241241
source_buffer.highlight_matching_brackets = Scratch.settings.get_boolean ("highlight-matching-brackets");
242+
source_buffer.highlight_syntax = Scratch.settings.get_boolean ("syntax-highlighting");
242243
space_drawer.enable_matrix = false;
243244
switch ((ScratchDrawSpacesState) Scratch.settings.get_enum ("draw-spaces")) {
244245
case ScratchDrawSpacesState.ALWAYS:

0 commit comments

Comments
 (0)