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
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."
;;;; 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))
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
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