[gnome-builder/wip/csoriano/fixing-vim-scrolling: 3/3] testing...



commit 929915d82a5bc605ef9d183d64fba4c117f99598
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Apr 7 19:43:05 2015 +0200

    testing...

 libide/ide-source-view.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 3166b29..fdb22ed 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -63,7 +63,7 @@
 #define ANIMATION_X_GROW  50
 #define ANIMATION_Y_GROW  30
 #define SMALL_SCROLL_DURATION_MSEC 100
-#define LARGE_SCROLL_DURATION_MSEC 250
+       #define LARGE_SCROLL_DURATION_MSEC 250
 #define FIXIT_LABEL_LEN_MAX 30
 
 #define _GDK_RECTANGLE_X2(rect) ((rect)->x + (rect)->width)
@@ -6310,6 +6310,7 @@ ide_source_view_get_visible_rect (IdeSourceView *self,
        * Use a multiple of the line height so we don't jump around when
        * focusing the last line (due to Y2 not fitting in the visible area).
        */
+      g_print ("cached %d, heigh %d\n", priv->cached_char_height, area.height);
       area.height = (area.height / priv->cached_char_height) * priv->cached_char_height;
     }
 
@@ -6336,7 +6337,7 @@ ide_source_view_scroll_mark_onscreen (IdeSourceView *self,
   gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark);
   gtk_text_view_get_iter_location (text_view, &iter, &mark_rect);
 
-  if (!_GDK_RECTANGLE_CONTAINS (&visible_rect, &mark_rect))
+  //if (!_GDK_RECTANGLE_CONTAINS (&visible_rect, &mark_rect))
     ide_source_view_scroll_to_mark (self, mark, 0.0, FALSE, 0.0, 0.0, TRUE);
 
   IDE_EXIT;
@@ -6424,6 +6425,9 @@ ide_source_view_scroll_to_iter (IdeSourceView     *self,
 
   TRACE_RECTANGLE ("visible_rect", &visible_rect);
   TRACE_RECTANGLE ("iter_rect", &iter_rect);
+  g_print ("visible_rect %d, %d, %d\n", visible_rect.y/priv->cached_char_height, 
visible_rect.height/priv->cached_char_height, _GDK_RECTANGLE_Y2 (&visible_rect)/priv->cached_char_height);
+  g_print ("real visible_rect %d, %d, %d\n", real_visible_rect.y/priv->cached_char_height, 
real_visible_rect.height/priv->cached_char_height, _GDK_RECTANGLE_Y2 
(&real_visible_rect)/priv->cached_char_height);
+  g_print ("iter_rect %d, %d, %d\n", iter_rect.y/priv->cached_char_height, 
iter_rect.height/priv->cached_char_height, _GDK_RECTANGLE_Y2 (&iter_rect)/priv->cached_char_height);
 
   /* leave a character of room to the right of the screen */
   visible_rect.width -= priv->cached_char_width;
@@ -6431,13 +6435,23 @@ ide_source_view_scroll_to_iter (IdeSourceView     *self,
   if (use_align == FALSE)
     {
       if (iter_rect.y < visible_rect.y)
+       {
         yalign = 0.0;
+       g_print ("less\n");
+       }
       else if (_GDK_RECTANGLE_Y2 (&iter_rect) > _GDK_RECTANGLE_Y2 (&visible_rect))
+       {
         yalign = 1.0;
+       g_print ("more\n");
+       }
       else
+       {
         yalign = (iter_rect.y - visible_rect.y)  / (gdouble)visible_rect.height;
+       g_print ("equal\n");
+       }
 
       IDE_TRACE_MSG ("yalign = %lf", yalign);
+      g_print ("scrolling %lf\n", yalign);
 
       if (iter_rect.x < visible_rect.x)
         {
@@ -6467,8 +6481,10 @@ ide_source_view_scroll_to_iter (IdeSourceView     *self,
   xalign = xoffset / (gdouble)real_visible_rect.width;
   yalign = yoffset / (gdouble)real_visible_rect.height;
 
+  g_print ("yoffset %d %d, yalign %f, diff %f\n", yoffset, yoffset/priv->cached_char_height, yalign, yalign 
* real_visible_rect.height/priv->cached_char_height);
   yvalue = iter_rect.y - (yalign * real_visible_rect.height);
   xvalue = iter_rect.x - (xalign * real_visible_rect.width);
+  g_print ("yvalue %f\n", yvalue/priv->cached_char_height);
 
   frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (self));
 
@@ -6513,6 +6529,7 @@ ignore_animation:
       gtk_adjustment_set_value (hadj, xvalue);
       gtk_adjustment_set_value (vadj, yvalue);
     }
+  g_print ("\n\n");
 
   IDE_EXIT;
 }


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