diff options
author | Po Lu <luangruo@yahoo.com> | 2021-12-23 09:12:02 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2021-12-23 18:55:54 +0800 |
commit | d54d8a88e9a2f12b69e820e9bb89e304521bc8c7 (patch) | |
tree | 6f94010f49db10a3a213f356f9463cfb934ad1e5 /doc/lispref/display.texi | |
parent | 2001ae5898a1e48cae5b138828190ac2cba39b40 (diff) | |
download | emacs-d54d8a88e9a2f12b69e820e9bb89e304521bc8c7.tar.gz emacs-d54d8a88e9a2f12b69e820e9bb89e304521bc8c7.tar.bz2 emacs-d54d8a88e9a2f12b69e820e9bb89e304521bc8c7.zip |
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.
Diffstat (limited to 'doc/lispref/display.texi')
-rw-r--r-- | doc/lispref/display.texi | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 98a15404f91..449a58a3bb9 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -2092,17 +2092,27 @@ pixels. @var{window} must be a live window and defaults to the selected one. The return value is a cons of the maximum pixel-width of any text line and the maximum pixel-height of all text lines. This function exists to allow Lisp programs to adjust the dimensions of -@var{window} to the buffer text it needs to display. +@var{window} to the buffer text it needs to display, and for other +similar situations. + +The return value can also optionally (see below) include the buffer +position of the first line whose dimensions were measured. The optional argument @var{from}, if non-@code{nil}, specifies the first text position to consider, and defaults to the minimum accessible position of the buffer. If @var{from} is @code{t}, it stands for the minimum accessible position that is not a newline -character. The optional argument @var{to}, if non-@code{nil}, -specifies the last text position to consider, and defaults to the -maximum accessible position of the buffer. If @var{to} is @code{t}, -it stands for the maximum accessible position that is not a newline -character. +character. If @var{from} is a cons, its @code{car} specifies a buffer +position, and its @code{cdr} specifies the vertical offset in pixels +from that position to the first screen line whose text is to be +measured. (The measurement will start from the visual beginning of +that screen line.) In that case, the return value will instead be a +list of the pixel-width, pixel-height, and the buffer position of the +first line that was measured. The optional argument @var{to}, if +non-@code{nil}, specifies the last text position to consider, and +defaults to the maximum accessible position of the buffer. If +@var{to} is @code{t}, it stands for the maximum accessible position +that is not a newline character. The optional argument @var{x-limit}, if non-@code{nil}, specifies the maximum X coordinate beyond which text should be ignored; it is |