Skip to content
  • kritarth's avatar
    Disable 'scroll-on-output' in build log panel · 60b5efe4
    kritarth authored and Sébastien Lafargue's avatar Sébastien Lafargue committed
    Currently, the build log panel is bound to scroll to end whenever new output
    is added to the buffer using gtk_text_view_scroll_to_mark. In order to disable
    this auto-scrolling I added horizontal and vertical GtkAdjustments. These
    adjustments are initialised in gbp_build_log_panel_init(). They point to
    the adjustments of GtkScrolledWindow scroller. With these adjustments I check
    if the user has scrolled back or right manually.
    
    expression1: value >= upper - page_size - offset
    This expression returns true if the user has not scrolled vertically back.
    The 'offset' is defined as VERTICAL_AUTOSCROLL_TOLERENCE - this means the
    limit upto which scroll-on-output will still work even if the user has
    manually scrolled.
    
    Similarly HORIZONTAL_AUTOSCROLL_TOLERENCE is defined.
    Detection of horizontal scrolling is done by
    expression2: value <= HORIZONTAL_AUTOSCROLL_TOLERENCE
    HORIZONTAL_AUTOSCROLL_TOLERENCE is set to 3 because the left-margin of text_view is also set at 3.
    
    if (expression1 && expression2) then
            set the vertical adjustment to upper - page_size
            apply this adjustment to the container
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775642
    60b5efe4