diff --git a/data/io.elementary.code.gschema.xml b/data/io.elementary.code.gschema.xml index 0f78a64f7..185986686 100644 --- a/data/io.elementary.code.gschema.xml +++ b/data/io.elementary.code.gschema.xml @@ -106,6 +106,11 @@ Highlight Matching Brackets Whether Code should highlight matching brackets. + + true + Highlight source code syntax + Whether Code should apply syntax highlighting to documents. + "For Selection" Draw spaces and tabs with symbols diff --git a/src/Dialogs/PreferencesDialog.vala b/src/Dialogs/PreferencesDialog.vala index 53288c398..ca081e591 100644 --- a/src/Dialogs/PreferencesDialog.vala +++ b/src/Dialogs/PreferencesDialog.vala @@ -110,6 +110,7 @@ public class Scratch.Dialogs.Preferences : Granite.Dialog { var editor_box = new Gtk.Box (VERTICAL, 12); editor_box.add (new Granite.HeaderLabel (_("Editor"))); editor_box.add (new SettingSwitch (_("Highlight matching brackets"), "highlight-matching-brackets")); + editor_box.add (new SettingSwitch (_("Syntax highlighting"), "syntax-highlighting")); editor_box.add (draw_spaces_box); editor_box.add (new SettingSwitch (_("Mini Map"), "show-mini-map")); editor_box.add (new SettingSwitch (_("Wrap lines"), "line-wrap")); diff --git a/src/Widgets/FormatBar.vala b/src/Widgets/FormatBar.vala index 53d4673ee..f7547fbd7 100644 --- a/src/Widgets/FormatBar.vala +++ b/src/Widgets/FormatBar.vala @@ -47,7 +47,7 @@ public class Code.FormatBar : Gtk.Box { lang_menubutton = new FormatButton () { icon = new ThemedIcon ("application-x-class-file-symbolic"), - tooltip_text = _("Syntax Highlighting") + tooltip_text = _("Document language") }; line_menubutton = new FormatButton () { diff --git a/src/Widgets/SourceView.vala b/src/Widgets/SourceView.vala index c03ddafba..a196a3409 100644 --- a/src/Widgets/SourceView.vala +++ b/src/Widgets/SourceView.vala @@ -95,7 +95,7 @@ namespace Scratch.Widgets { var source_buffer = new Gtk.SourceBuffer (null); set_buffer (source_buffer); - source_buffer.highlight_syntax = true; + source_buffer.highlight_syntax = Scratch.settings.get_boolean ("syntax-highlighting"); source_buffer.mark_set.connect (on_mark_set); source_buffer.mark_deleted.connect (on_mark_deleted); highlight_current_line = true; @@ -239,6 +239,7 @@ namespace Scratch.Widgets { insert_spaces_instead_of_tabs = Scratch.settings.get_boolean ("spaces-instead-of-tabs"); var source_buffer = (Gtk.SourceBuffer) buffer; source_buffer.highlight_matching_brackets = Scratch.settings.get_boolean ("highlight-matching-brackets"); + source_buffer.highlight_syntax = Scratch.settings.get_boolean ("syntax-highlighting"); space_drawer.enable_matrix = false; switch ((ScratchDrawSpacesState) Scratch.settings.get_enum ("draw-spaces")) { case ScratchDrawSpacesState.ALWAYS: