1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-30 08:09:04 +00:00
Commit Graph

69 Commits

Author SHA1 Message Date
Po Lu
f9d518bc2f Make precision scrolling also work on various bars
* lisp/pixel-scroll.el (pixel-scroll-precision-mode-map):
Define keys for various kinds of bars.
2021-12-23 21:35:46 +08:00
Po Lu
03dc54ba7f Fix precision scrolling down for multi-line display strings
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page): Make sure Y delta
is appropriate before deciding on next-pos.
2021-12-23 21:26:59 +08:00
Po Lu
902f343c18 Set start to desired start when pixel scrolling to end of buffer
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page): Set start to desired
start when point cannot be moved further down.
2021-12-23 19:00:30 +08:00
Po Lu
d54d8a88e9 Allow window-text-pixel-size to measure pixels around a position
* doc/lispref/display.texi (Size of Displayed Text): Announce
new meaning of `from'.
* etc/NEWS: Announce changes.

* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-up-page):
Use new feature.

* src/xdisp.c (window_text_pixel_size): Understand a special
format of `from' that specifies the amount of pixels above or
below a position.

(Fwindow_text_pixel_size): Update doc string.
2021-12-23 18:55:54 +08:00
Po Lu
861eee4241 Work around pixel scrolling issues when line numbers are displayed
* lisp/pixel-scroll.el (pixel-point-and-height-at-unseen-line):
Compare start position against line number display width
instead.
2021-12-15 10:27:27 +08:00
Po Lu
2f66010549 Work around pixel scrolling issues when org-indent-mode is on
* lisp/pixel-scroll.el (pixel-point-and-height-at-unseen-line):
Subtract line height of window start when it doesn't appear
at the 0th pixel of the line.
2021-12-13 09:59:39 +08:00
Po Lu
ff9360f4da Clear precision scroll interpolation when direction changes
* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate):
Clear scroll interpolation when direction changes.
2021-12-12 10:54:50 +08:00
Po Lu
6e865a7171 Further reduce image-related stutter during precision scrolling
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page): Disable
`scroll-preserve-screen-position' and `auto-window-vscroll'
while scrolling.
2021-12-10 14:20:32 +08:00
Po Lu
636704fab9 Stop setting `make-cursor-line-fully-visible' in precision scrolling
* lisp/pixel-scroll.el (pixel-scroll-precision-mode): Stop
setting `make-cursor-line-fully-visible'.
2021-12-10 06:03:39 +00:00
Po Lu
59db96d83a Fix bob detection when pixel scrolling upwards
* lisp/pixel-scroll.el (pixel-point-and-height-at-unseen-line):
Don't go to the beginning-of-visual-line if bobp.
2021-12-10 11:30:07 +08:00
Po Lu
2e4740f042 Fix pixel scrolling upwards in Info buffers
* lisp/pixel-scroll.el (pixel-point-and-height-at-unseen-line):
Don't blindly trust window start to be the beginning of a
visual line.
2021-12-10 11:25:10 +08:00
Po Lu
e8d90a3fd4 Remove unused let-bindings from pixel-scroll.el
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page): Remove unused
bindings.
2021-12-10 10:38:24 +08:00
Po Lu
b867eb2216 Fix precision scrolling for stretch glyphs
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page): Simplify logic.
(pixel-scroll-precision-interpolate): Block throw-on-input
when actually scrolling.
2021-12-10 10:35:05 +08:00
Po Lu
948a8936ba Make precision scrolling up work over display strings
* lisp/pixel-scroll.el
(pixel-point-and-height-at-unseen-line): Use
`window-text-pixel-size'.
(pixel-scroll-precision-scroll-up-page): Use delta as vscroll
directly.
2021-12-09 17:57:25 +08:00
Po Lu
07d95325e4 Fix pixel scrolling over lines with different sized glyphs
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page): Calculate desired
vscroll with `window-text-pixel-size'.
2021-12-09 17:40:08 +08:00
Po Lu
52f3fe46a3 Fix jumping cursor during interpolated scrolls
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page): Go to next position
before setting start or vscroll.
2021-12-09 11:40:39 +08:00
Po Lu
bb1252bdb3 Allow customizing step between each interpolated scroll
* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate):
Use new option.
(pixel-scroll-precision-interpolation-between-scroll): New user
option.
2021-12-09 11:12:39 +08:00
Po Lu
f10d4b31d6 Clear scroll interpolation when interpolated scroll completes
* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate): Set
saved interpolation to nil upon completion.
2021-12-08 18:36:18 +08:00
Po Lu
d8c383b25e Improve precision scroll interpolation
* lisp/pixel-scroll.el
(pixel-scroll-precision-interpolation-total-time)
(pixel-scroll-precision-interpolation-factor): Add better
default values.

(pixel-scroll-precision-interpolate): Save deltas and run loop
inside `while-no-input' instead.
2021-12-08 18:30:37 +08:00
Po Lu
b0a960308b Fix last change
* lisp/pixel-scroll.el
(pixel-scroll-precision-interpolation-total-time)
(pixel-scroll-precision-interpolation-factor): Fix declared versions.
2021-12-08 15:52:21 +08:00
Po Lu
bf79dad3f2 Make interpolated scrolling work better
* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate):
Stop using `while-no-input'.
2021-12-08 13:40:12 +08:00
Po Lu
c4dab6c179 Allow customizing precision scroll interpolation
* lisp/pixel-scroll.el
(pixel-scroll-precision-interpolation-total-time)
(pixel-scroll-precision-interpolation-factor): New user
options.
(pixel-scroll-precision-interpolate): Use these new options.

(pixel-scroll-precision-mode): Set
`make-cursor-line-fully-visible' to nil.
2021-12-08 13:02:16 +08:00
Po Lu
e449f62a79 Fix jittering when precision scrolling over images
* lisp/pixel-scroll.el
(pixel-scroll-precision-initial-velocity-factor): Default to
nil.
(pixel-scroll-precision-scroll-down-page): Always set window
start.
2021-12-06 09:41:49 +08:00
Po Lu
622550f718 Interpolate large pixel scrolls
* lisp/pixel-scroll.el
(pixel-scroll-precision-large-scroll-height): New user option.
(pixel-scroll-precision-interpolate): New function.
(pixel-scroll-precision): Interpolate scrolls under some
circumstances.
2021-12-05 21:36:12 +08:00
Po Lu
643eee8b1b Make pixel scrolling through images less jumpy
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page): Improve detection of
situations where vscroll must directly be set.
2021-12-05 09:46:42 +08:00
Po Lu
fba17b0747 Make precision pixel scrolling work in an hscrolled window
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page)
(pixel-scroll-precision-scroll-up-page): Use beginning of visual
line as window start if hscrolled.
(pixel-scroll-precision): Don't delegate to mwheel-scroll if
window is hscrolled.
2021-12-04 14:04:04 +08:00
Po Lu
be1359884f Make last change work for deltas that are multiples of max-height
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down-page)
(pixel-scroll-precision-scroll-up-page): Use `max-height' that
is slightly less than the text height of the window.
2021-12-04 09:43:44 +08:00
Po Lu
1450fa16ed Make it work to pixel scroll by deltas larger than the window
* lisp/pixel-scroll.el
(pixel-scroll-precision-scroll-down-page):
(pixel-scroll-precision-scroll-up-page): New functions.

(pixel-scroll-precision-scroll-up)
(pixel-scroll-precision-scroll-down): Make it safe to scroll
by deltas larger than the current window.
2021-12-04 09:09:28 +08:00
Po Lu
1afa295aed Improve velocity calculation in momentum scrolling
* lisp/pixel-scroll.el
(pixel-scroll-precision-momentum-factor): Remove option.
(pixel-scroll-precision-initial-velocity-factor)
(pixel-scroll-precision-momentum-min-velocity): New user
options.
(pixel-scroll-accumulate-velocity): Clear velocity ring
if sign is different.
(pixel-scroll-calculate-velocity): Use current time.
(pixel-scroll-start-momentum): Use better algorithm.
2021-12-03 14:04:04 +08:00
Po Lu
67191f7eee Make momentum scrolling much nicer
* lisp/pixel-scroll.el (pixel-scroll-precision-momentum-tick):
Set default value to 0.01.
(pixel-scroll-precision-momentum-seconds): New user option.
(pixel-scroll-start-momentum): Improvements to momentum
algorithm.
2021-12-03 10:12:29 +08:00
Po Lu
ef2c386829 * lisp/pixel-scroll.el (pixel-scroll-start-momentum): Fix algorithm. 2021-12-03 08:59:24 +08:00
Po Lu
d45e72fe5a Improve momentum scrolling algorithm
* lisp/pixel-scroll.el (pixel-scroll-precision-momentum-tick):
(pixel-scroll-precision-momentum-factor): New user options.

(pixel-scroll-kinetic-state, pixel-scroll-accumulate-velocity):
Set scroll momentum ring size to 10.

(pixel-scroll-start-momentum): Improve algorithm.
2021-12-02 19:36:33 +08:00
Po Lu
603bdc8d38 Add some primitive momentum-based precision scrolling
The algorithm used to scroll the display kinetically is very
simple and needs improvement.  Someone should work on that
eventually.

* lisp/pixel-scroll.el (pixel-scroll-precision-use-momentum):
New user option.
(pixel-scroll-precision-mode-map): Add
`pixel-scroll-start-momentum'.
(pixel-scroll-kinetic-state):
(pixel-scroll-accumulate-velocity):
(pixel-scroll-calculate-velocity): New functions.
(pixel-scroll-start-momentum): New command.

* src/xterm.c (handle_one_xevent): Fix touch-end event
generation.
2021-12-02 11:01:59 +08:00
Po Lu
a4ff841154 Fix precision scrolling when there is a scroll margin
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down)
(pixel-scroll-precision-scroll-up): Take scroll margin into
accout.
2021-12-02 09:56:52 +08:00
Po Lu
01a6c0b409 Get rid of vmotion loop in `pixel-scroll-precision-scroll-up'
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-up): Use
posn-at-x-y for cursor motion.
2021-12-02 09:15:43 +08:00
Po Lu
2ee6621fe9 Fix precision pixel scrolling for a recent change
* lisp/pixel-scroll.el (pixel-scroll-precision-mode-map): Use
`mwheel-coalesce-scroll-events' instead.
2021-12-01 21:54:10 +08:00
Po Lu
541f61b378 Avoid unnecessary call when pixel scrolling
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down):
Avoid unnecessary call to `posn-at-point'
2021-12-01 11:22:58 +08:00
Po Lu
034d8a3ea8 Make pixel scrolling faster
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down): Get
rid of big motion loop.
(pixel-scroll-precision-scroll-up): Stop subtracting height of
window lines.
2021-12-01 09:35:10 +08:00
Po Lu
55151f94ea Fix pixel scrolling again
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down): Fix
confusion about absolutivity of `window-edges'.
2021-11-30 20:49:59 +08:00
Po Lu
6c17cdc1dc Fix 1-off errors in pixel scrolling code
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down): Fix
one-off errors.
2021-11-30 20:44:54 +08:00
Po Lu
b79d779ae8 Improve upwards pixel scrolling for large images
This fixes most of the problem, but with a large image the
vscroll can sometimes jump about, which has to be fixed.

* lisp/pixel-scroll.el (pixel-scroll-precision-up): Handle
vscrolling large images in the first unseen line.
2021-11-30 20:36:43 +08:00
Po Lu
f633116c09 * lisp/pixel-scroll.el (pixel-scroll-precision): Handle zero delta. 2021-11-30 19:28:04 +08:00
Po Lu
3cba568886 Fix annoying bell rings when pixel scrolling to buffer limits
* lisp/pixel-scroll.el (pixel-scroll-precision): Don't ding at
buffer limits.
2021-11-30 14:05:18 +08:00
Po Lu
3c2afa66a2 Make `pixel-scroll-precision-scroll-up' work better with overlays
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-up):
Just set vscroll when on overlay.
2021-11-28 09:06:11 +08:00
Po Lu
f9457b8b01 Fix pixel scroll for overlays and text in display properties
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down):
Just set vscroll if we're scrolling through an overlay or
something to that effect.
2021-11-27 20:09:33 +08:00
Po Lu
3dc9eb8bbd Remove GC prone call in `pixel-point-and-height-at-unseen-line'
* lisp/pixel-scroll.el (pixel-point-and-height-at-unseen-line):
Remove call to unnecessary call to `beginning-of-visual-line'.
2021-11-27 14:10:49 +08:00
Po Lu
141425ce3b Make `pixel-scroll-precision-scroll-up' slightly more robust
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-up):
Subtract from existing vscroll if feasible.
2021-11-27 13:46:35 +08:00
Po Lu
d329014574 Make `pixel-scroll-precision-scroll-up' use existing logic
* lisp/pixel-scroll.el (pixel-point-at-unseen-line): Rewrite
to use `pixel-point-and-height-at-unseen-line'.
(pixel-point-and-height-at-unseen-line): New function.
(pixel-scroll-precision-scroll-up): Use existing logic
to determine unseen line position.
2021-11-27 13:03:54 +08:00
Po Lu
5d6e1c749a Move the precision pixel scrolling feature to pixel-scroll.el
* etc/NEWS: Update NEWS entry for 'pixel-scroll-precision-mode'

* lisp/better-pixel-scroll.el: Remove file.

* src/pixel-scroll.el (x-coalesce-scroll-events): New variable
declaration.
(pixel-scroll-precision-mode-map): New variable.
(pixel-scroll-precision-scroll-down):
(pixel-scroll-precision-scroll-up):
(pixel-scroll-precision): New functions.
(pixel-scroll-precision-mode): New minor mode.
2021-11-26 21:06:22 +08:00
Stefan Kangas
63f419f133 ; Minor stylistic fixes found by checkdoc 2021-09-16 19:37:07 +02:00