summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2000-12-11 07:22:38 +0000
committerMiles Bader <miles@gnu.org>2000-12-11 07:22:38 +0000
commit81fe08361535eccdb6d2745082db9a85eff470c2 (patch)
tree6319a29f4b645173979153dd187a31aaa16d3038
parentdb7ebd73606a431ba968376a06cd6ebbfd39ccd0 (diff)
downloademacs-81fe08361535eccdb6d2745082db9a85eff470c2.tar.gz
(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.
-rw-r--r--src/window.c23
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)
if (old_buffer)
set_buffer_internal (old_buffer);
- /* Add in empty lines at the bottom of the window. */
bottom_y = it.current_y + it.max_ascent + it.max_descent;
+
+ if (bottom_y > it.current_y && bottom_y < it.last_visible_y)
+ /* Hit a line without a terminating newline. */
+ it.vpos++;
+
+ /* Add in empty lines at the bottom of the window. */
if (bottom_y < height)
{
struct frame *f = XFRAME (w->frame);
@@ -4487,6 +4492,21 @@ displayed_window_lines (w)
}
+DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height,
+ 0, 1, 0,
+ "Return the height in lines of the text display area of WINDOW.\n\
+This doesn't include the mode-line (or header-line if any) or any\n\
+partial-height lines in the text display area.")
+ (window)
+ Lisp_Object window;
+{
+ struct window *w = decode_window (window);
+ int pixel_height = window_box_height (w);
+ int line_height = pixel_height / CANON_Y_UNIT (XFRAME (w->frame));
+ return make_number (line_height);
+}
+
+
DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line,
1, 1, "P",
@@ -5739,6 +5759,7 @@ The selected frame is the one whose configuration has changed.");
defsubr (&Sother_window_for_scrolling);
defsubr (&Sscroll_other_window);
defsubr (&Srecenter);
+ defsubr (&Swindow_text_height);
defsubr (&Smove_to_window_line);
defsubr (&Swindow_configuration_p);
defsubr (&Swindow_configuration_frame);