[gtksourceview/gnome-3-24] view: handle cases where indent-width and tab-width match



commit cba46d776f413a07288ec37edadf07be5fd330e3
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 6190440..0a60446 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -3262,7 +3262,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;
 
@@ -3523,7 +3524,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]