# HG changeset patch # User Gerd Moellmann # Date 977931977 0 # Node ID 3af71a0ef007d0a33a6d2f1901cf47337f182893 # Parent 68280f3ea5a210f70da521b3cbba48a1b2a9d2d1 (Frecenter): Use displayed_window_lines instead of window_internal_height. diff -r 68280f3ea5a2 -r 3af71a0ef007 src/window.c --- a/src/window.c Wed Dec 27 14:38:04 2000 +0000 +++ b/src/window.c Wed Dec 27 15:46:17 2000 +0000 @@ -4433,60 +4433,6 @@ - XINT (arg))); } -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\ -Just C-u as prefix means put point in the center of the window.\n\ -If ARG is omitted or nil, erases the entire frame and then\n\ -redraws with point in the center of the current window.") - (arg) - register Lisp_Object arg; -{ - register struct window *w = XWINDOW (selected_window); - register int ht = window_internal_height (w); - struct position pos; - struct buffer *buf = XBUFFER (w->buffer); - struct buffer *obuf = current_buffer; - - if (NILP (arg)) - { - extern int frame_garbaged; - int i; - - /* Invalidate pixel data calculated for all compositions. */ - for (i = 0; i < n_compositions; i++) - composition_table[i]->font = NULL; - - Fredraw_frame (w->frame); - SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w))); - XSETFASTINT (arg, ht / 2); - } - else if (CONSP (arg)) /* Just C-u. */ - { - XSETFASTINT (arg, ht / 2); - } - else - { - arg = Fprefix_numeric_value (arg); - CHECK_NUMBER (arg, 0); - } - - if (XINT (arg) < 0) - XSETINT (arg, XINT (arg) + ht); - - set_buffer_internal (buf); - pos = *vmotion (PT, - XINT (arg), w); - - set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); - w->start_at_line_beg = ((pos.bytepos == BEGV_BYTE - || FETCH_BYTE (pos.bytepos - 1) == '\n') - ? Qt : Qnil); - w->force_start = Qt; - set_buffer_internal (obuf); - - return Qnil; -} - /* Value is the number of lines actually displayed in window W, as opposed to its height. */ @@ -4535,6 +4481,61 @@ } +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\ +Just C-u as prefix means put point in the center of the window.\n\ +If ARG is omitted or nil, erases the entire frame and then\n\ +redraws with point in the center of the current window.") + (arg) + register Lisp_Object arg; +{ + register struct window *w = XWINDOW (selected_window); + register int ht = displayed_window_lines (w); + struct position pos; + struct buffer *buf = XBUFFER (w->buffer); + struct buffer *obuf = current_buffer; + + if (NILP (arg)) + { + extern int frame_garbaged; + int i; + + /* Invalidate pixel data calculated for all compositions. */ + for (i = 0; i < n_compositions; i++) + composition_table[i]->font = NULL; + + Fredraw_frame (w->frame); + SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w))); + XSETFASTINT (arg, ht / 2); + } + else if (CONSP (arg)) /* Just C-u. */ + { + XSETFASTINT (arg, ht / 2); + } + else + { + arg = Fprefix_numeric_value (arg); + CHECK_NUMBER (arg, 0); + } + + if (XINT (arg) < 0) + XSETINT (arg, XINT (arg) + ht); + + set_buffer_internal (buf); + pos = *vmotion (PT, - XINT (arg), w); + + set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); + w->start_at_line_beg = ((pos.bytepos == BEGV_BYTE + || FETCH_BYTE (pos.bytepos - 1) == '\n') + ? Qt : Qnil); + w->force_start = Qt; + set_buffer_internal (obuf); + + return Qnil; +} + + 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\