[meld: 3/5] filediff: Correct some scroll syncing variable naming and comments



commit d42574a0f0344bc8d1bc0f0d049add297478afae
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Nov 3 05:52:33 2019 +1000

    filediff: Correct some scroll syncing variable naming and comments

 meld/filediff.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 90de6381..6d56fe4b 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -2075,17 +2075,18 @@ class FileDiff(Gtk.VBox, MeldDoc):
     def _sync_vscroll(self, adjustment, master):
         syncpoint = misc.calc_syncpoint(adjustment)
 
-        # Middle of the screen, in buffer coords
-        middle_y = (
+        # Sync point in buffer coords; this will usually be the middle
+        # of the screen, except at the top and bottom of the document.
+        sync_y = (
             adjustment.get_value() + adjustment.get_page_size() * syncpoint)
 
         # Find the target line. This is a float because, especially for
         # wrapped lines, the sync point may be half way through a line.
         # Not doing this calculation makes scrolling jerky.
-        middle_iter, _ = self.textview[master].get_line_at_y(int(middle_y))
-        line_y, height = self.textview[master].get_line_yrange(middle_iter)
+        sync_iter, _ = self.textview[master].get_line_at_y(int(sync_y))
+        line_y, height = self.textview[master].get_line_yrange(sync_iter)
         height = height or 1
-        target_line = middle_iter.get_line() + ((middle_y - line_y) / height)
+        target_line = sync_iter.get_line() + ((sync_y - line_y) / height)
 
         # In the case of two pane scrolling, it's clear how to bind
         # scrollbars: if the user moves the left pane, we move the


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