1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00
Commit Graph

90 Commits

Author SHA1 Message Date
Eli Zaretskii
6ad041939b Support 'isearch-allow-scroll' in 'pixel-scroll-precision-mode'
* lisp/pixel-scroll.el (pixel-scroll-precision)
(pixel-scroll-down, pixel-scroll-up): Put the 'scroll-command'
property on these commands.  (Bug#63640)
2023-05-22 14:20:38 +03:00
Eli Zaretskii
cae528457c ; Add 2023 to copyright years. 2023-01-01 05:31:12 -05:00
Po Lu
517268d943 Small adjustments to precision pixel scrolling
* lisp/pixel-scroll.el
(pixel-scroll-precision-interpolation-factor): Adjust for
increased accuracy.
(pixel-scroll-precision-interpolate): Slightly decrease accuracy
in exchange for consing less floats.
(pixel-scroll-interpolate-down, pixel-scroll-interpolate-up):
Fix usage of function.
2022-09-21 19:32:52 +08:00
Po Lu
61e4964a8a Improve scroll interpolation in pixel-s-precision-mode
* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate): New
arg FACTOR.  Use it to determine the interpolation factor if
non-nil.  Also, clear scroll remainder if direction changes, and
determine deltas based on the absolute amount of time passed.
(bug#57967)
(pixel-scroll-interpolate-down, pixel-scroll-interpolate-up):
Pass factor of 0 to scroll exactly 1 page.
2022-09-21 19:32:51 +08:00
Stefan Kangas
16d6ef13c2 Prefer defvar-keymap in pixel-scroll-precision-mode-map
* lisp/pixel-scroll.el (pixel-scroll-precision-mode-map): Prefer
defvar-keymap.
2022-09-13 11:06:40 +02:00
Gerd Möllmann
1f990d1cf9 Fix pixel-scroll-precision in a corner case
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-up-page): Handle
case that point cannot be found.
(pixel-scroll-precision-scroll-up): Handle case that window is one line high
(bug#57349)
2022-08-23 15:53:10 +02:00
Po Lu
cfb295f1e5 Prevent GC threshold from exceeding fixnum limit during precision scrolling
* lisp/pixel-scroll.el (pixel-scroll-start-momentum): Prevent GC
threshold from exceeding most-positive-fixnum.
2022-08-03 11:42:22 +08:00
Po Lu
40c0124816 Minor improvements to precision scroll interpolation
* lisp/pixel-scroll.el (pixel-scroll-start-momentum): Bump GC
cons threshold temporarily.  This leads to a very noticable
improvement to animation speed.
2022-07-30 11:26:46 +08:00
Po Lu
fd8eaa72a6 Allow precision-scrolling nonselected windows when the minibuffer is resized
* doc/lispref/windows.texi (Vertical Scrolling): Document new
`preserve-vscroll-p' parameter of `set-window-vscroll'.
* etc/NEWS: Announce new parameter.

* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down-page)
(pixel-scroll-precision-scroll-up-page): Use that parameter when
setting the vscroll.

* src/window.c (window_scroll_pixel_based, Fset_window_vscroll):
Adjust for new parameter.
* src/window.h (struct window): New flag `preserve_vscroll_p'.

* src/xdisp.c (redisplay_window): Preserve the vscroll inside
force_start on frozen windows with that flag set.  (bug#55312)
2022-05-09 09:37:58 +08:00
Po Lu
410690085e Interpolate scrolls coming from mice by default
* lisp/pixel-scroll.el
(pixel-scroll-precision-interpolate-mice): New
user option.
(pixel-scroll-precision): If the class of the last event device
is `mouse', interpolate the next scroll.
2022-04-08 18:57:29 +08:00
Markus Kopp
51a98a92e9 Use CUA functions to scroll pages with pixel-scroll-scroll-mode
* lisp/pixel-scroll.el (pixel-scroll-interpolate-down)
(pixel-scroll-interpolate-up): Use `cua-scroll-up' and
`cua-scroll-down' to scroll if
`pixel-scroll-precision-interpolate-page' is off.  (bug#54696)
2022-04-06 17:30:20 +08:00
Po Lu
dd71222208 Make precision scrolling on top of the tool bar work
* lisp/pixel-scroll.el (pixel-scroll-precision-mode-map): Bind
some more events.

(pixel-scroll-precision):
(pixel-scroll-start-momentum): If window is a frame, use its
selected window.
2022-03-01 15:38:37 +08:00
Po Lu
a2e80d2a41 Make interpolated scrolling work above non-selected windows
* lisp/pixel-scroll.el (pixel-scroll-precision-interpolate): New
parameter `old-window'.
(pixel-scroll-precision): Pass originally selected window to the
interpolation function.
2022-02-25 14:15:51 +08:00
Po Lu
6b0e23412d Improve momentum pixel scrolling on a non-selected window
* lisp/pixel-scroll.el (pixel-scroll-kinetic-state): New
argument `window'.
(pixel-scroll-start-momentum): Don't select the window under
the event when calculating velocity or redisplaying.
2022-02-22 11:35:27 +08:00
Po Lu
63eab2948a * lisp/pixel-scroll.el: Update commentary. 2022-02-05 19:48:23 +08:00
Eli Zaretskii
dcd76bd48d Merge from origin/emacs-28
836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year.
86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year
ebe8772f65 ; Minor fixes related to copyright years
23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye...
8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t.
19dcb237b5 ; Add 2022 to copyright years.

# Conflicts:
#	etc/NEWS
#	etc/refcards/ru-refcard.tex
#	lib/cdefs.h
#	lisp/erc/erc-dcc.el
#	lisp/erc/erc-imenu.el
#	lisp/erc/erc-replace.el
#	lisp/image-dired.el
#	lisp/progmodes/xref.el
#	m4/alloca.m4
#	m4/byteswap.m4
#	m4/errno_h.m4
#	m4/getopt.m4
#	m4/gnulib-common.m4
#	m4/inttypes.m4
#	m4/stddef_h.m4
#	m4/stdint.m4
#	m4/sys_socket_h.m4
2022-01-01 07:03:03 -05:00
Po Lu
4dce09db18 Increase size of precision scrolling momentum ring
* lisp/pixel-scroll.el
(pixel-scroll-precision-initial-velocity-factor): Fix
calculation of last timestamp.
(pixel-scroll-precision):
(pixel-scroll-kinetic-state):
(pixel-scroll-accumulate-velocity):
(pixel-scroll-start-momentum):
(pixel-scroll-calculate-velocity): Increase default ring size
to 30.
2022-01-01 19:35:12 +08:00
Eli Zaretskii
19dcb237b5 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
Po Lu
736bf3aaa7 Store sign separately when accumulating precision scroll momentum
* lisp/pixel-scroll.el (pixel-scroll-kinetic-state): Return
vector in new format.
(pixel-scroll-accumulate-velocity): Use new sign field.
2021-12-27 09:02:20 +08:00
Po Lu
bb666073d3 Allow interpolating scrolls via the Page Down and Page Up keys
* lisp/pixel-scroll.el (pixel-scroll-precision-mode-map): Define
new commands.
(pixel-scroll-precision-interpolate-page): New user option.
(pixel-scroll-interpolate-down):
(pixel-scroll-interpolate-up): New functions.
2021-12-26 10:36:05 +08:00
Po Lu
c9f05cbe3f Make precision scrolling work on margins and fringes
* lisp/pixel-scroll.el (pixel-scroll-precision-mode-map): Add
missing key definitions.
2021-12-24 15:35:39 +08:00
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