[polari] Make line indicator dependent on line spacing



commit 13641c916bac86acfdfa195c86b6cf70b73a2920
Author: Bastian Ilso <bastianilso gnome org>
Date:   Wed Apr 1 14:58:04 2015 +0200

    Make line indicator dependent on line spacing
    
    The position of the 'new messages' line indicator
    was based on a constant 'LINE_INDICATOR_OFFSET'.
    The line indicators position is now dependent on
    the linespacing used by the GtkTextView.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738671

 src/chatView.js |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 7fa714b..a915620 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -22,8 +22,6 @@ const TIMESTAMP_INTERVAL = 300; // seconds of inactivity after which to
 const NUM_INITIAL_LOG_EVENTS = 50; // number of log events to fetch on start
 const NUM_LOG_EVENTS = 10; // number of log events to fetch when requesting more
 
-const INDICATOR_OFFSET = 5; // TODO: should be based on line spacing
-
 const MARGIN = 6;
 
 // Workaround for GtkTextView growing horizontally over time when
@@ -65,8 +63,10 @@ const TextView = new Lang.Class({
                                                  location.x, location.y);
         let border = this.border_width;
 
+        let lineSpace = (this.get_pixels_above_lines(this) +
+                         this.get_pixels_below_lines(this)) / 2;
         Gdk.cairo_set_source_rgba(cr, this._dimColor);
-        cr.rectangle(border, y + INDICATOR_OFFSET,
+        cr.rectangle(border, y - lineSpace,
                      this.get_allocated_width() - 2 * border, 1);
         cr.fill();
         cr.$dispose();


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