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

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

[elpa] master 13bf083 39/50: handle on-screen-treat-cut-lines -> t nicel


From: Michael Heerdegen
Subject: [elpa] master 13bf083 39/50: handle on-screen-treat-cut-lines -> t nicely
Date: Mon, 09 Nov 2015 03:35:53 +0000

branch: master
commit 13bf08362dbf796db1d9baef7cf02304b19d6434
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

    handle on-screen-treat-cut-lines -> t nicely
---
 on-screen.el |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/on-screen.el b/on-screen.el
index 9e0e54e..08048bb 100644
--- a/on-screen.el
+++ b/on-screen.el
@@ -229,6 +229,8 @@ changes to a buffer highlighting is always removed to avoid
 confusion."
   :group 'on-screen :type 'boolean)
 
+(defvar on-screen-treat-cut-lines--default-fraction .3)
+
 (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
@@ -237,9 +239,11 @@ 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)))
+  :type `(choice (const :tag "Count partially visible lines as visible"   nil)
+                 (const :tag "Count partially visible lines as not visible" t)
+                 (float
+                  :tag "Count lines with hidden part less than this as visible"
+                  :value ,on-screen-treat-cut-lines--default-fraction)))
 
 (defcustom on-screen-drawing-threshold 2
   "If set, highlight only when scrolled at least that many lines."
@@ -307,6 +311,11 @@ Type M-x customize-group on-screen RET for configuration."
 
 ;;;; Internal functions
 
+(defun on-screen--treat-cut-lines-get-fraction ()
+  (if (floatp on-screen-treat-cut-lines)
+      on-screen-treat-cut-lines
+    on-screen-treat-cut-lines--default-fraction))
+
 (defun on-screen-window-start (&optional window)
   "Like `window-start', but exclude partially visible lines."
   (let* ((start (window-start window))
@@ -315,7 +324,7 @@ Type M-x customize-group on-screen RET for configuration."
         start
       (cl-destructuring-bind (_x _y rtop _rbot rowh _vpos) vis
         (if (< (/ (float rtop) (+ rtop rowh))
-               (if (floatp on-screen-treat-cut-lines) 
on-screen-treat-cut-lines .4)) ; count as visible
+               (on-screen--treat-cut-lines-get-fraction)) ; count as visible
             start
           (with-current-buffer (window-buffer window)
             (save-excursion
@@ -331,7 +340,7 @@ Type M-x customize-group on-screen RET for configuration."
         end
       (cl-destructuring-bind (_x _y _rtop rbot rowh _vpos) vis
         (if (< (/ (float rbot) (+ rbot rowh))
-               (if (floatp on-screen-treat-cut-lines) 
on-screen-treat-cut-lines .4)) ; count as visible
+               (on-screen--treat-cut-lines-get-fraction)) ; count as visible
             end
           (with-current-buffer (window-buffer window)
             (save-excursion



reply via email to

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