emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 6b88eaa 10/50: on-screen-treat-cut-lines, default nil (fas


From: Michael Heerdegen
Subject: [elpa] master 6b88eaa 10/50: on-screen-treat-cut-lines, default nil (faster)
Date: Mon, 09 Nov 2015 03:35:42 +0000

branch: master
commit 6b88eaad55b79d3071a4859c8ee67ac6dcaae202
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

    on-screen-treat-cut-lines, default nil (faster)
---
 on-screen.el |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/on-screen.el b/on-screen.el
index 7fb1da4..745cb12 100644
--- a/on-screen.el
+++ b/on-screen.el
@@ -197,6 +197,17 @@ drawn highlighting will remain fixed relative to the text 
even
 if you scroll further until `on-screen-delay' is over."
   :group 'on-screen :type 'boolean)
 
+(defcustom on-screen-treat-cut-lines nil
+  "Whether to care about vertically cut lines.
+If nil, always count lines at the window start or end that are
+only partially visible as part of the visible area.  Else, a
+number between 0 and 1, meaning that lines will count as visible
+when the hidden part of them is less than this number.  Note that
+a non-nil value may make scrolling stuttering on slow computers."
+  :group 'on-screen
+  :type '(choice (const :tag "Count vertically cut lines as visible" nil)
+                 (float :tag "Count lines with hidden part less than this as 
visible"
+                       :value .4)))
 
 ;;; Other variables
 
@@ -241,11 +252,11 @@ Type M-x customize-group on-screen RET for configuration."
 (defun on-screen-window-start (&optional window)
   "Like `window-start', but exclude partially visible lines."
   (let* ((start (window-start window))
-         (vis (pos-visible-in-window-p start window t)))
+         (vis (and on-screen-treat-cut-lines (pos-visible-in-window-p start 
window t))))
     (if (not (cddr vis))
         start
       (destructuring-bind (_x _y rtop _rbot rowh _vpos) vis
-        (if (< (/ (float rtop) (+ rtop rowh)) .4) ;; count as visible
+        (if (< (/ (float rtop) (+ rtop rowh)) on-screen-treat-cut-lines) ;; 
count as visible
             start
           (with-current-buffer (window-buffer window)
             (save-excursion
@@ -256,11 +267,11 @@ Type M-x customize-group on-screen RET for configuration."
 (defun on-screen-window-end (&optional window)
   "Like `window-end', but exclude partially visible lines."
   (let* ((end (window-end window))
-         (vis (pos-visible-in-window-p (1- end) window t)))
+         (vis (and on-screen-treat-cut-lines (pos-visible-in-window-p (1- end) 
window t))))
     (if (not (cddr vis))
         end
       (destructuring-bind (_x _y _rtop rbot rowh _vpos) vis
-        (if (< (/ (float rbot) (+ rbot rowh)) .4) ;; count as visible
+        (if (< (/ (float rbot) (+ rbot rowh)) on-screen-treat-cut-lines) ;; 
count as visible
             end
           (with-current-buffer (window-buffer window)
             (save-excursion



reply via email to

[Prev in Thread] Current Thread [Next in Thread]