[gtksourceview] view: handle cases where indent-width and tab-width match



commit 14bca910793717f858165d0fec0fe76d5cec19c2
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 31 01:37:10 2017 -0700

    view: handle cases where indent-width and tab-width match
    
    Currently, indent-width is set to -1 to set a behavior that it should
    inherit the value of tab-width. However, if the value actually matches
    tab-width, a different behavior is applied for the insertion of tabs.
    
    This handles that scenario when indenting and lines and inserting tabs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786988

 gtksourceview/gtksourceview.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 63c95bb..f68cc29 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -3208,7 +3208,8 @@ gtk_source_view_indent_lines (GtkSourceView *view,
 
                tab_buffer = g_strnfill (spaces, ' ');
        }
-       else if (view->priv->indent_width > 0)
+       else if (view->priv->indent_width > 0 &&
+                view->priv->indent_width != (gint)view->priv->tab_width)
        {
                guint indent_width;
 
@@ -3469,7 +3470,8 @@ insert_tab_or_spaces (GtkSourceView *view,
 
                tab_buf = g_strnfill (spaces, ' ');
        }
-       else if (view->priv->indent_width > 0)
+       else if (view->priv->indent_width > 0 &&
+                view->priv->indent_width != (gint)view->priv->tab_width)
        {
                GtkTextIter iter;
                gint i;


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