Commit 12c8b416 authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

(Frecenter): Use displayed_window_lines instead

of window_internal_height.
parent 6061fbf0
2000-12-27 Gerd Moellmann <gerd@gnu.org>
* window.c (Frecenter): Use displayed_window_lines instead
of window_internal_height.
* xterm.c (syms_of_xterm): DEFVAR_LISP x-toolkit-scroll-bars
instead of x-toolkit-scroll-bars-p.
(Vx_toolkit_scroll_bars): Renamed from x_toolkit_scroll_bars_p.
......
......@@ -4433,6 +4433,54 @@ Default for ARG is window width minus 2.")
- XINT (arg)));
}
/* Value is the number of lines actually displayed in window W,
as opposed to its height. */
static int
displayed_window_lines (w)
struct window *w;
{
struct it it;
struct text_pos start;
int height = window_box_height (w);
struct buffer *old_buffer;
int bottom_y;
if (XBUFFER (w->buffer) != current_buffer)
{
old_buffer = current_buffer;
set_buffer_internal (XBUFFER (w->buffer));
}
else
old_buffer = NULL;
SET_TEXT_POS_FROM_MARKER (start, w->start);
start_display (&it, w, start);
move_it_vertically (&it, height);
if (old_buffer)
set_buffer_internal (old_buffer);
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);
int rest = height - bottom_y;
int lines = rest / CANON_Y_UNIT (f);
it.vpos += lines;
}
return it.vpos;
}
DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P",
"Center point in window and redisplay frame. With ARG, put point on line ARG.\n\
The desired position of point is always relative to the current window.\n\
......@@ -4443,7 +4491,7 @@ redraws with point in the center of the current window.")
register Lisp_Object arg;
{
register struct window *w = XWINDOW (selected_window);
register int ht = window_internal_height (w);
register int ht = displayed_window_lines (w);
struct position pos;
struct buffer *buf = XBUFFER (w->buffer);
struct buffer *obuf = current_buffer;
......@@ -4488,53 +4536,6 @@ redraws with point in the center of the current window.")
}
/* Value is the number of lines actually displayed in window W,
as opposed to its height. */
static int
displayed_window_lines (w)
struct window *w;
{
struct it it;
struct text_pos start;
int height = window_box_height (w);
struct buffer *old_buffer;
int bottom_y;
if (XBUFFER (w->buffer) != current_buffer)
{
old_buffer = current_buffer;
set_buffer_internal (XBUFFER (w->buffer));
}
else
old_buffer = NULL;
SET_TEXT_POS_FROM_MARKER (start, w->start);
start_display (&it, w, start);
move_it_vertically (&it, height);
if (old_buffer)
set_buffer_internal (old_buffer);
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);
int rest = height - bottom_y;
int lines = rest / CANON_Y_UNIT (f);
it.vpos += lines;
}
return it.vpos;
}
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\
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment