[gtksourceview] gtksourceview: use tab-width for visual column



commit d3840c958e31efd6c73c54b46a6445207186453c
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 29 15:09:44 2019 -0700

    gtksourceview: use tab-width for visual column
    
    We need to ensure we use the tab-width here instead of the indent-width
    because we've already inserted tabs (as opposed to querying how much to
    potentially indet with a \t).
    
    Fixes #64

 gtksourceview/gtksourceview.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index de136600..60c2701c 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -4594,26 +4594,24 @@ guint
 gtk_source_view_get_visual_column (GtkSourceView     *view,
                                   const GtkTextIter *iter)
 {
-       gunichar tab_char;
        GtkTextIter position;
-       guint column, indent_width;
+       guint column;
+       guint tab_width;
 
        g_return_val_if_fail (GTK_SOURCE_IS_VIEW (view), 0);
        g_return_val_if_fail (iter != NULL, 0);
 
-       tab_char = g_utf8_get_char ("\t");
-
        column = 0;
-       indent_width = get_real_indent_width (view);
+       tab_width = view->priv->tab_width;
 
        position = *iter;
        gtk_text_iter_set_line_offset (&position, 0);
 
        while (!gtk_text_iter_equal (&position, iter))
        {
-               if (gtk_text_iter_get_char (&position) == tab_char)
+               if (gtk_text_iter_get_char (&position) == '\t')
                {
-                       column += (indent_width - (column % indent_width));
+                       column += (tab_width - (column % tab_width));
                }
                else
                {


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