diff options
| author | Miles Bader | 2000-12-11 07:22:38 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-12-11 07:22:38 +0000 |
| commit | 81fe08361535eccdb6d2745082db9a85eff470c2 (patch) | |
| tree | 6319a29f4b645173979153dd187a31aaa16d3038 /src/window.c | |
| parent | db7ebd73606a431ba968376a06cd6ebbfd39ccd0 (diff) | |
| download | emacs-81fe08361535eccdb6d2745082db9a85eff470c2.tar.gz emacs-81fe08361535eccdb6d2745082db9a85eff470c2.zip | |
(displayed_window_lines): Handle non-newline-terminated final lines properly.
(Fwindow_text_height): New function (used to be in lisp).
(syms_of_window): Initialize it.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/window.c b/src/window.c index 5a54f46091c..677dc9aedcd 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4473,8 +4473,13 @@ displayed_window_lines (w) | |||
| 4473 | if (old_buffer) | 4473 | if (old_buffer) |
| 4474 | set_buffer_internal (old_buffer); | 4474 | set_buffer_internal (old_buffer); |
| 4475 | 4475 | ||
| 4476 | /* Add in empty lines at the bottom of the window. */ | ||
| 4477 | bottom_y = it.current_y + it.max_ascent + it.max_descent; | 4476 | bottom_y = it.current_y + it.max_ascent + it.max_descent; |
| 4477 | |||
| 4478 | if (bottom_y > it.current_y && bottom_y < it.last_visible_y) | ||
| 4479 | /* Hit a line without a terminating newline. */ | ||
| 4480 | it.vpos++; | ||
| 4481 | |||
| 4482 | /* Add in empty lines at the bottom of the window. */ | ||
| 4478 | if (bottom_y < height) | 4483 | if (bottom_y < height) |
| 4479 | { | 4484 | { |
| 4480 | struct frame *f = XFRAME (w->frame); | 4485 | struct frame *f = XFRAME (w->frame); |
| @@ -4487,6 +4492,21 @@ displayed_window_lines (w) | |||
| 4487 | } | 4492 | } |
| 4488 | 4493 | ||
| 4489 | 4494 | ||
| 4495 | DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, | ||
| 4496 | 0, 1, 0, | ||
| 4497 | "Return the height in lines of the text display area of WINDOW.\n\ | ||
| 4498 | This doesn't include the mode-line (or header-line if any) or any\n\ | ||
| 4499 | partial-height lines in the text display area.") | ||
| 4500 | (window) | ||
| 4501 | Lisp_Object window; | ||
| 4502 | { | ||
| 4503 | struct window *w = decode_window (window); | ||
| 4504 | int pixel_height = window_box_height (w); | ||
| 4505 | int line_height = pixel_height / CANON_Y_UNIT (XFRAME (w->frame)); | ||
| 4506 | return make_number (line_height); | ||
| 4507 | } | ||
| 4508 | |||
| 4509 | |||
| 4490 | 4510 | ||
| 4491 | DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, | 4511 | DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, |
| 4492 | 1, 1, "P", | 4512 | 1, 1, "P", |
| @@ -5739,6 +5759,7 @@ The selected frame is the one whose configuration has changed."); | |||
| 5739 | defsubr (&Sother_window_for_scrolling); | 5759 | defsubr (&Sother_window_for_scrolling); |
| 5740 | defsubr (&Sscroll_other_window); | 5760 | defsubr (&Sscroll_other_window); |
| 5741 | defsubr (&Srecenter); | 5761 | defsubr (&Srecenter); |
| 5762 | defsubr (&Swindow_text_height); | ||
| 5742 | defsubr (&Smove_to_window_line); | 5763 | defsubr (&Smove_to_window_line); |
| 5743 | defsubr (&Swindow_configuration_p); | 5764 | defsubr (&Swindow_configuration_p); |
| 5744 | defsubr (&Swindow_configuration_frame); | 5765 | defsubr (&Swindow_configuration_frame); |