[gnome-text-editor] editorconfig: add support for "indent_size"
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] editorconfig: add support for "indent_size"
- Date: Wed, 27 Oct 2021 14:15:51 +0000 (UTC)
commit 9a03a0182cac4a4c7983d5443b5cf13d71b7355e
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 27 07:15:02 2021 -0700
editorconfig: add support for "indent_size"
Related #200
src/editorconfig/editor-page-editorconfig.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff --git a/src/editorconfig/editor-page-editorconfig.c b/src/editorconfig/editor-page-editorconfig.c
index d3838e5..da1b1b6 100644
--- a/src/editorconfig/editor-page-editorconfig.c
+++ b/src/editorconfig/editor-page-editorconfig.c
@@ -32,10 +32,12 @@ struct _EditorPageEditorconfig
EditorDocument *document;
+ int indent_width;
guint tab_width;
guint right_margin_position;
guint insert_spaces_instead_of_tabs : 1;
+ guint indent_width_set : 1;
guint tab_width_set : 1;
guint right_margin_position_set : 1;
guint insert_spaces_instead_of_tabs_set : 1;
@@ -85,6 +87,11 @@ editor_page_editorconfig_reload (EditorPageEditorconfig *self)
self->insert_spaces_instead_of_tabs = g_strcmp0 (str, "tab") != 0;
self->insert_spaces_instead_of_tabs_set = TRUE;
}
+ else if (g_str_equal (key, "indent_size"))
+ {
+ self->indent_width = g_value_get_int (value);
+ self->indent_width_set = TRUE;
+ }
}
if (g_hash_table_size (ht) > 0)
@@ -146,6 +153,15 @@ editor_page_editorconfig_get_tab_width (EditorPageSettingsProvider *provider,
return self->tab_width_set;
}
+static gboolean
+editor_page_editorconfig_get_indent_width (EditorPageSettingsProvider *provider,
+ int *indent_width)
+{
+ EditorPageEditorconfig *self = EDITOR_PAGE_EDITORCONFIG (provider);
+ *indent_width = self->indent_width;
+ return self->indent_width_set;
+}
+
static gboolean
editor_page_editorconfig_get_insert_spaces_instead_of_tabs (EditorPageSettingsProvider *provider,
gboolean
*insert_spaces_instead_of_tabs)
@@ -162,6 +178,7 @@ page_settings_provider_iface_init (EditorPageSettingsProviderInterface *iface)
iface->get_insert_spaces_instead_of_tabs = editor_page_editorconfig_get_insert_spaces_instead_of_tabs;
iface->get_tab_width = editor_page_editorconfig_get_tab_width;
iface->get_right_margin_position = editor_page_editorconfig_get_right_margin_position;
+ iface->get_indent_width = editor_page_editorconfig_get_indent_width;
}
G_DEFINE_TYPE_WITH_CODE (EditorPageEditorconfig, editor_page_editorconfig, G_TYPE_OBJECT,
@@ -202,4 +219,8 @@ editor_page_editorconfig_class_init (EditorPageEditorconfigClass *klass)
static void
editor_page_editorconfig_init (EditorPageEditorconfig *self)
{
+ self->tab_width = 8;
+ self->indent_width = -1;
+ self->insert_spaces_instead_of_tabs = TRUE;
+ self->right_margin_position = 80;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]