[gnome-builder] editorconfig: allow disabling show-right-margin with <= 0



commit fbb49153d72651af798811eb932862c5167965e4
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jan 22 11:15:44 2021 -0800

    editorconfig: allow disabling show-right-margin with <= 0
    
    If max_line_length is set to <= 0, then disable right margin position. This
    allows the user to completely disable right-margin using .editorconfig in
    their $HOME directory.
    
    Fixes #1389

 src/plugins/editorconfig/gbp-editorconfig-file-settings.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/editorconfig/gbp-editorconfig-file-settings.c 
b/src/plugins/editorconfig/gbp-editorconfig-file-settings.c
index eecd43b42..27e6cc5fb 100644
--- a/src/plugins/editorconfig/gbp-editorconfig-file-settings.c
+++ b/src/plugins/editorconfig/gbp-editorconfig-file-settings.c
@@ -95,8 +95,15 @@ gbp_editorconfig_file_settings_init_worker (IdeTask      *task,
         g_object_set_property (source_object, "encoding", value);
       else if (g_str_equal (key, "max_line_length"))
         {
-          g_object_set_property (source_object, "right-margin-position", value);
-          g_object_set (source_object, "show-right-margin", TRUE, NULL);
+          if (g_value_get_int (value) <= 0)
+            {
+              g_object_set (source_object, "show-right-margin", FALSE, NULL);
+            }
+          else
+            {
+              g_object_set_property (source_object, "right-margin-position", value);
+              g_object_set (source_object, "show-right-margin", TRUE, NULL);
+            }
         }
       else if (g_str_equal (key, "end_of_line"))
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]