comparison lispref/positions.texi @ 39167:97f7986f0b80

Rewrite and move definition of count-screen-lines. Minor clarifications.
author Richard M. Stallman <rms@gnu.org>
date Thu, 06 Sep 2001 19:49:21 +0000
parents 67ec449a2b50
children dd80762eccd5
comparison
equal deleted inserted replaced
39166:f0bfa8a7d472 39167:97f7986f0b80
188 @deffn Command forward-word count 188 @deffn Command forward-word count
189 This function moves point forward @var{count} words (or backward if 189 This function moves point forward @var{count} words (or backward if
190 @var{count} is negative). ``Moving one word'' means moving until point 190 @var{count} is negative). ``Moving one word'' means moving until point
191 crosses a word-constituent character and then encounters a 191 crosses a word-constituent character and then encounters a
192 word-separator character. However, this function cannot move point past 192 word-separator character. However, this function cannot move point past
193 the boundary of the accessible part of the buffer, or across a field 193 the boundary of the accessible portion of the buffer, or across a field
194 boundary (@pxref{Fields}). The most common case of a field boundary is 194 boundary (@pxref{Fields}). The most common case of a field boundary is
195 the end of the prompt in the minibuffer. 195 the end of the prompt in the minibuffer.
196 196
197 If it is possible to move @var{count} words, without being stopped 197 If it is possible to move @var{count} words, without being stopped
198 prematurely by the buffer boundary or a field boundary, the value is 198 prematurely by the buffer boundary or a field boundary, the value is
489 These functions scan text to determine where screen lines break, and 489 These functions scan text to determine where screen lines break, and
490 thus take time proportional to the distance scanned. If you intend to 490 thus take time proportional to the distance scanned. If you intend to
491 use them heavily, Emacs provides caches which may improve the 491 use them heavily, Emacs provides caches which may improve the
492 performance of your code. @xref{Truncation, cache-long-line-scans}. 492 performance of your code. @xref{Truncation, cache-long-line-scans}.
493 493
494
495 @defun vertical-motion count &optional window 494 @defun vertical-motion count &optional window
496 This function moves point to the start of the screen line @var{count} 495 This function moves point to the start of the screen line @var{count}
497 screen lines down from the screen line containing point. If @var{count} 496 screen lines down from the screen line containing point. If @var{count}
498 is negative, it moves up instead. 497 is negative, it moves up instead.
499 498
503 502
504 The window @var{window} is used for obtaining parameters such as the 503 The window @var{window} is used for obtaining parameters such as the
505 width, the horizontal scrolling, and the display table. But 504 width, the horizontal scrolling, and the display table. But
506 @code{vertical-motion} always operates on the current buffer, even if 505 @code{vertical-motion} always operates on the current buffer, even if
507 @var{window} currently displays some other buffer. 506 @var{window} currently displays some other buffer.
507 @end defun
508
509 @defun count-screen-lines &optional beg end count-final-newline window
510 This function returns the number of screen lines in the text from
511 @var{beg} to @var{end}. The number of screen lines may be different
512 from the number of actual lines, due to line continuation, the display
513 table, etc. If @var{beg} and @var{end} are @code{nil} or omitted,
514 they default to the beginning and end of the accessible portion of the
515 buffer.
516
517 If the region ends with a newline, that is ignored unless the optional
518 third argument @var{count-final-newline} is non-@code{nil}.
519
520 The optional fourth argument @var{window} specifies the window for
521 obtaining parameters such as width, horizontal scrolling, and so on.
522 The default is to use the selected window's parameters.
523
524 Like @code{vertical-motion}, @code{count-screen-lines} always uses the
525 current buffer, regardless of which buffer is displayed in
526 @var{window}. This makes possible to use @code{count-screen-lines} in
527 any buffer, whether or not it is currently displayed in some window.
508 @end defun 528 @end defun
509 529
510 @deffn Command move-to-window-line count 530 @deffn Command move-to-window-line count
511 This function moves point with respect to the text currently displayed 531 This function moves point with respect to the text currently displayed
512 in the selected window. It moves point to the beginning of the screen 532 in the selected window. It moves point to the beginning of the screen
525 In an interactive call, @var{count} is the numeric prefix argument. 545 In an interactive call, @var{count} is the numeric prefix argument.
526 546
527 The value returned is the window line number point has moved to, with 547 The value returned is the window line number point has moved to, with
528 the top line in the window numbered 0. 548 the top line in the window numbered 0.
529 @end deffn 549 @end deffn
530
531 @defun count-screen-lines &optional beg end count-final-newline window
532 This function returns the number of the screen lines occupied by the
533 text between positions @var{beg} and @var{end}. These arguments default
534 to the beginning and end of the accessible portion of the buffer.
535
536 If region ends with a newline, it is significant if
537 @var{count-final-newline} is non-@code{nil}. Otherwise it is ignored.
538
539 The argument @var{window} specifies the window used for obtaining
540 parameters such as width, horizontal scrolling, and so on. The default
541 is the selected window.
542
543 Like @code{vertical-motion}, @code{count-screen-lines} always uses the
544 current buffer, regardless of which buffer is displayed in @var{window}.
545 This makes possible to use @code{count-screen-lines} in any buffer,
546 whether or not it is currently displayed in some window.
547 @end defun
548 550
549 @defun compute-motion from frompos to topos width offsets window 551 @defun compute-motion from frompos to topos width offsets window
550 This function scans the current buffer, calculating screen positions. 552 This function scans the current buffer, calculating screen positions.
551 It scans the buffer forward from position @var{from}, assuming that is 553 It scans the buffer forward from position @var{from}, assuming that is
552 at screen coordinates @var{frompos}, to position @var{to} or coordinates 554 at screen coordinates @var{frompos}, to position @var{to} or coordinates