/* Updating of data structures for redisplay.
- Copyright (C) 1985, 86, 87, 88, 93, 94, 95, 97, 1998
+ Copyright (C) 1985, 86, 87, 88, 93, 94, 95, 97, 98, 1999
Free Software Foundation, Inc.
This file is part of GNU Emacs.
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <signal.h>
#include <config.h>
+#include <signal.h>
#include <stdio.h>
#include <ctype.h>
#include "cm.h"
#include "buffer.h"
#include "charset.h"
+#include "keyboard.h"
#include "frame.h"
#include "window.h"
#include "commands.h"
#include "intervals.h"
#include "blockinput.h"
#include "process.h"
-#include "keyboard.h"
/* I don't know why DEC Alpha OSF1 fail to compile this file if we
include the following file. */
#include "w32term.h"
#endif /* HAVE_NTGUI */
+#ifdef macintosh
+#include "macterm.h"
+#endif /* macintosh */
+
/* Include systime.h after xterm.h to avoid double inclusion of time.h. */
#include "systime.h"
#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__bufp - (FILE)->__buffer)
#endif
#else /* not __GNU_LIBRARY__ */
+#if !defined (PENDING_OUTPUT_COUNT) && HAVE_STDIO_EXT_H && HAVE___FPENDING
+#include <stdio_ext.h>
+#define PENDING_OUTPUT_COUNT(FILE) __fpending (FILE)
+#endif
#ifndef PENDING_OUTPUT_COUNT
#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base)
#endif
#endif /* not __GNU_LIBRARY__ */
+#if defined (LINUX) && defined (HAVE_LIBNCURSES)
+#include <term.h> /* for tgetent */
+#endif
\f
/* Structure to pass dimensions around. Used for character bounding
boxes, glyph matrix dimensions and alike. */
static void free_glyph_matrix P_ ((struct glyph_matrix *));
static void adjust_glyph_matrix P_ ((struct window *, struct glyph_matrix *,
int, int, struct dim));
-static void change_frame_size_1 P_ ((struct frame *, int, int, int, int));
-static void swap_glyphs_in_rows P_ ((struct glyph_row *, struct glyph_row *));
+static void change_frame_size_1 P_ ((struct frame *, int, int, int, int, int));
static void swap_glyph_pointers P_ ((struct glyph_row *, struct glyph_row *));
+#ifdef GLYPH_DEBUG
static int glyph_row_slice_p P_ ((struct glyph_row *, struct glyph_row *));
+#endif
static void fill_up_frame_row_with_spaces P_ ((struct glyph_row *, int));
static void build_frame_matrix_from_window_tree P_ ((struct glyph_matrix *,
struct window *));
static void clear_window_matrices P_ ((struct window *, int));
static void fill_up_glyph_row_area_with_spaces P_ ((struct glyph_row *, int));
static int scrolling_window P_ ((struct window *, int));
-static int update_window_line P_ ((struct window *, int));
+static int update_window_line P_ ((struct window *, int, int *));
static void update_marginal_area P_ ((struct window *, int, int));
static int update_text_area P_ ((struct window *, int));
static void make_current P_ ((struct glyph_matrix *, struct glyph_matrix *,
int));
static void mirror_make_current P_ ((struct window *, int));
void check_window_matrix_pointers P_ ((struct window *));
+#if GLYPH_DEBUG
static void check_matrix_pointers P_ ((struct glyph_matrix *,
struct glyph_matrix *));
+#endif
static void mirror_line_dance P_ ((struct window *, int, int, int *, char *));
static int update_window_tree P_ ((struct window *, int));
static int update_window P_ ((struct window *, int));
static int update_frame_1 P_ ((struct frame *, int, int));
static void set_window_cursor_after_update P_ ((struct window *));
static int row_equal_p P_ ((struct window *, struct glyph_row *,
- struct glyph_row *));
+ struct glyph_row *, int));
static void adjust_frame_glyphs_for_window_redisplay P_ ((struct frame *));
static void adjust_frame_glyphs_for_frame_redisplay P_ ((struct frame *));
static void reverse_rows P_ ((struct glyph_matrix *, int, int));
static int margin_glyphs_to_reserve P_ ((struct window *, int, Lisp_Object));
+static void sync_window_with_frame_matrix_rows P_ ((struct window *));
+struct window *frame_row_to_window P_ ((struct window *, int));
\f
int cursor_in_echo_area;
-Lisp_Object Qdisplay_table;
+Lisp_Object Qdisplay_table, Qredisplay_dont_pause;
\f
/* The currently selected frame. In a single-frame version, this
- variable always holds the address of the_only_frame. */
+ variable always equals the_only_frame. */
-struct frame *selected_frame;
+Lisp_Object selected_frame;
/* A frame which is not just a mini-buffer, or 0 if there are no such
frames. This is usually the most recent such frame that was
int i;
int new_rows;
int marginal_areas_changed_p = 0;
- int top_line_changed_p = 0;
- int top_line_p = 0;
+ int header_line_changed_p = 0;
+ int header_line_p = 0;
int left = -1, right = -1;
int window_x, window_y, window_width, window_height;
/* See if W had a top line that has disappeared now, or vice versa. */
if (w)
{
- top_line_p = WINDOW_WANTS_TOP_LINE_P (w);
- top_line_changed_p = top_line_p != matrix->top_line_p;
+ header_line_p = WINDOW_WANTS_HEADER_LINE_P (w);
+ header_line_changed_p = header_line_p != matrix->header_line_p;
}
- matrix->top_line_p = top_line_p;
+ matrix->header_line_p = header_line_p;
/* Do nothing if MATRIX' size, position, vscroll, and marginal areas
haven't changed. This optimization is important because preserving
if (!marginal_areas_changed_p
&& !fonts_changed_p
- && !top_line_changed_p
+ && !header_line_changed_p
&& matrix->window_top_y == XFASTINT (w->top)
&& matrix->window_height == window_height
&& matrix->window_vscroll == w->vscroll
if (w == NULL
|| row == matrix->rows + dim.height - 1
- || (row == matrix->rows && matrix->top_line_p))
+ || (row == matrix->rows && matrix->header_line_p))
{
row->glyphs[TEXT_AREA]
= row->glyphs[LEFT_MARGIN_AREA];
its own memory. Allocate glyph memory from the heap. */
if (dim.width > matrix->matrix_w
|| new_rows
- || top_line_changed_p
+ || header_line_changed_p
|| marginal_areas_changed_p)
{
struct glyph_row *row = matrix->rows;
/* The mode line never has marginal areas. */
if (row == matrix->rows + dim.height - 1
- || (row == matrix->rows && matrix->top_line_p))
+ || (row == matrix->rows && matrix->header_line_p))
{
row->glyphs[TEXT_AREA]
= row->glyphs[LEFT_MARGIN_AREA];
/* Number of rows to be used by MATRIX. */
matrix->nrows = dim.height;
+ xassert (matrix->nrows >= 0);
/* Mark rows in a current matrix of a window as not having valid
contents. It's important to not do this for desired matrices.
DELTA_BYTES. */
void
-increment_glyph_matrix_buffer_positions (matrix, start, end, delta,
- delta_bytes)
+increment_matrix_positions (matrix, start, end, delta, delta_bytes)
struct glyph_matrix *matrix;
int start, end, delta, delta_bytes;
{
xassert (start <= end);
for (; start < end; ++start)
- increment_glyph_row_buffer_positions (matrix->rows + start,
- delta, delta_bytes);
+ increment_row_positions (matrix->rows + start, delta, delta_bytes);
}
xassert (start >= 0 && start < matrix->nrows);
xassert (end >= 0 && end <= matrix->nrows);
- min_y = WINDOW_DISPLAY_TOP_LINE_HEIGHT (w);
+ min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);
for (; start < end; ++start)
if (WINDOWP (f->menu_bar_window))
clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix);
- /* Clear the matrix of the toolbar window, if any. */
- if (WINDOWP (f->toolbar_window))
- clear_glyph_matrix (XWINDOW (f->toolbar_window)->current_matrix);
+ /* Clear the matrix of the tool-bar window, if any. */
+ if (WINDOWP (f->tool_bar_window))
+ clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
/* Clear current window matrices. */
xassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
if (WINDOWP (f->menu_bar_window))
clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix);
- if (WINDOWP (f->toolbar_window))
- clear_glyph_matrix (XWINDOW (f->toolbar_window)->desired_matrix);
+ if (WINDOWP (f->tool_bar_window))
+ clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix);
/* Do it for window matrices. */
xassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
row->glyphs[TEXT_AREA] = p[TEXT_AREA];
row->glyphs[RIGHT_MARGIN_AREA] = p[RIGHT_MARGIN_AREA];
row->glyphs[LAST_AREA] = p[LAST_AREA];
+
+#if 0 /* At some point, some bit-fields of struct glyph were not set,
+ which made glyphs unequal when compared with GLYPH_EQUAL_P.
+ Redisplay outputs such glyphs, and flickering effects were
+ the result. This also depended on the contents of memory
+ returned by xmalloc. If flickering happens again, activate
+ the code below If the flickering is gone with that, chances
+ are that the flickering has the same reason as here. */
+ bzero (p[0], (char *) p[LAST_AREA] - (char *) p[0]);
+#endif
}
{
int min_y, max_y;
- min_y = WINDOW_DISPLAY_TOP_LINE_HEIGHT (w);
+ min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);
clear_glyph_row (row);
ends. */
void
-increment_glyph_row_buffer_positions (row, delta, delta_bytes)
+increment_row_positions (row, delta, delta_bytes)
struct glyph_row *row;
int delta, delta_bytes;
{
}
+#if 0
/* Swap glyphs between two glyph rows A and B. This exchanges glyph
contents, i.e. glyph structure contents are exchanged between A and
B without changing glyph pointers in A and B. */
}
}
+#endif /* 0 */
/* Exchange pointers to glyph memory between glyph rows A and B. */
from->used[area] * sizeof (struct glyph));
/* Increment buffer positions in TO by DELTA. */
- increment_glyph_row_buffer_positions (to, delta, delta_bytes);
+ increment_row_positions (to, delta, delta_bytes);
}
is non-zero if the glyph memory of WINDOW_ROW is part of the glyph
memory of FRAME_ROW. */
+#ifdef GLYPH_DEBUG
+
static int
glyph_row_slice_p (window_row, frame_row)
struct glyph_row *window_row, *frame_row;
&& window_glyph_start < frame_glyph_end);
}
+#endif /* GLYPH_DEBUG */
+
+#if 0
/* Find the row in the window glyph matrix WINDOW_MATRIX being a slice
of ROW in the frame matrix FRAME_MATRIX. Value is null if no row
return i < window_matrix->nrows ? window_matrix->rows + i : 0;
}
+#endif /* 0 */
/* Prepare ROW for display. Desired rows are cleared lazily,
i.e. they are only marked as to be cleared by setting their
while (glyph < end)
{
- GLYPH g = GLYPH_FROM_CHAR_GLYPH (*glyph);
+ int c = glyph->u.ch;
+ int face_id = glyph->face_id;
if (must_write_spaces)
- g -= SPACEGLYPH;
- hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + g;
+ c -= SPACEGLYPH;
+ hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + c;
+ hash = (((hash << 4) + (hash >> 24)) & 0x0fffffff) + face_id;
++glyph;
}
{
GLYPH g = GLYPH_FROM_CHAR_GLYPH (*beg);
- if (GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g))
+ if (g < 0
+ || GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g))
len += 1;
else
len += GLYPH_LENGTH (glyph_table_base, g);
/* Test two glyph rows A and B for equality. Value is non-zero if A
and B have equal contents. W is the window to which the glyphs
rows A and B belong. It is needed here to test for partial row
- visibility. */
+ visibility. MOUSE_FACE_P non-zero means compare the mouse_face_p
+ flags of A and B, too. */
static INLINE int
-row_equal_p (w, a, b)
+row_equal_p (w, a, b, mouse_face_p)
struct window *w;
struct glyph_row *a, *b;
+ int mouse_face_p;
{
if (a == b)
return 1;
struct glyph *a_glyph, *b_glyph, *a_end;
int area;
+ if (mouse_face_p && a->mouse_face_p != b->mouse_face_p)
+ return 0;
+
/* Compare glyphs. */
for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
{
#if GLYPH_DEBUG
+
+/* Flush standard output. This is sometimes useful to call from
+ the debugger. */
+
+void
+flush_stdout ()
+{
+ fflush (stdout);
+}
+
+
/* Check that no glyph pointers have been lost in MATRIX. If a
pointer has been lost, e.g. by using a structure assignment between
rows, at least one pointer must occur more than once in the rows of
/* Width and height MUST be chosen so that there are no
holes in the frame matrix. */
- dim.width = w->width;
- dim.height = w->height;
+ dim.width = XINT (w->width);
+ dim.height = XINT (w->height);
/* Will matrix be re-allocated? */
if (x != w->desired_matrix->matrix_x
static void
adjust_frame_glyphs_initially ()
{
- struct window *root = XWINDOW (selected_frame->root_window);
+ struct frame *sf = SELECTED_FRAME ();
+ struct window *root = XWINDOW (sf->root_window);
struct window *mini = XWINDOW (root->next);
- int frame_height = FRAME_HEIGHT (selected_frame);
- int frame_width = FRAME_WIDTH (selected_frame);
- int top_margin = FRAME_TOP_MARGIN (selected_frame);
+ int frame_height = FRAME_HEIGHT (sf);
+ int frame_width = FRAME_WIDTH (sf);
+ int top_margin = FRAME_TOP_MARGIN (sf);
/* Do it for the root window. */
XSETFASTINT (root->top, top_margin);
XSETFASTINT (root->width, frame_width);
- set_window_height (selected_frame->root_window,
- frame_height - 1 - top_margin, 0);
+ set_window_height (sf->root_window, frame_height - 1 - top_margin, 0);
/* Do it for the mini-buffer window. */
XSETFASTINT (mini->top, frame_height - 1);
XSETFASTINT (mini->width, frame_width);
set_window_height (root->next, 1, 0);
- adjust_frame_glyphs (selected_frame);
+ adjust_frame_glyphs (sf);
glyphs_initialized_initially_p = 1;
}
}
#endif /* not USE_X_TOOLKIT */
- /* Allocate/ reallocate matrices of the toolbar window. If we don't
- have a toolbar window yet, make one. */
- if (NILP (f->toolbar_window))
+ /* Allocate/ reallocate matrices of the tool bar window. If we
+ don't have a tool bar window yet, make one. */
+ if (NILP (f->tool_bar_window))
{
- f->toolbar_window = make_window ();
- w = XWINDOW (f->toolbar_window);
+ f->tool_bar_window = make_window ();
+ w = XWINDOW (f->tool_bar_window);
XSETFRAME (w->frame, f);
w->pseudo_window_p = 1;
}
else
- w = XWINDOW (f->toolbar_window);
+ w = XWINDOW (f->tool_bar_window);
XSETFASTINT (w->top, FRAME_MENU_BAR_LINES (f));
XSETFASTINT (w->left, 0);
- XSETFASTINT (w->height, FRAME_TOOLBAR_LINES (f));
+ XSETFASTINT (w->height, FRAME_TOOL_BAR_LINES (f));
XSETFASTINT (w->width, FRAME_WINDOW_WIDTH (f));
allocate_matrices_for_window_redisplay (w, ch_dim);
}
/* Adjust/ allocate message buffer of frame F.
- The global variables echo_area_glyphs and previous_echo_area_glyphs
- may be pointing to the frames message buffer and must be relocated
- if the buffer is reallocated.
-
Note that the message buffer is never freed. Since I could not
find a free in 19.34, I assume that freeing it would be
problematic in some way and don't do it either.
{
char *buffer = FRAME_MESSAGE_BUF (f);
char *new_buffer = (char *) xrealloc (buffer, size);
-
- if (buffer == echo_area_glyphs)
- echo_area_glyphs = new_buffer;
- if (buffer == previous_echo_glyphs)
- previous_echo_glyphs = new_buffer;
-
FRAME_MESSAGE_BUF (f) = new_buffer;
}
else
{
if (f && f->glyphs_initialized_p)
{
+ /* Block interrupt input so that we don't get surprised by an X
+ event while we're in an inconsistent state. */
+ BLOCK_INPUT;
f->glyphs_initialized_p = 0;
/* Release window sub-matrices. */
f->menu_bar_window = Qnil;
}
- /* Free the toolbar window and its glyph matrices. */
- if (!NILP (f->toolbar_window))
+ /* Free the tool bar window and its glyph matrices. */
+ if (!NILP (f->tool_bar_window))
{
- struct window *w = XWINDOW (f->toolbar_window);
+ struct window *w = XWINDOW (f->tool_bar_window);
free_glyph_matrix (w->desired_matrix);
free_glyph_matrix (w->current_matrix);
w->desired_matrix = w->current_matrix = NULL;
- f->toolbar_window = Qnil;
+ f->tool_bar_window = Qnil;
}
/* Release frame glyph matrices. Reset fields to zero in
free_glyph_pool (f->current_pool);
f->desired_pool = f->current_pool = NULL;
}
+
+ UNBLOCK_INPUT;
}
}
{
struct glyph_row *frame_row = frame_matrix->rows + frame_y;
struct glyph_row *window_row = window_matrix->rows + window_y;
+ int current_row_p = window_matrix == w->current_matrix;
/* Fill up the frame row with spaces up to the left margin of the
window row. */
/* Fill up areas in the window matrix row with spaces. */
fill_up_glyph_row_with_spaces (window_row);
+
+ /* If only part of W's desired matrix has been built, and
+ window_row wasn't displayed, use the corresponding current
+ row instead. */
+ if (window_matrix == w->desired_matrix
+ && !window_row->enabled_p)
+ {
+ window_row = w->current_matrix->rows + window_y;
+ current_row_p = 1;
+ }
- if (window_matrix == w->current_matrix)
+ if (current_row_p)
{
- /* We have to copy W's current matrix. Copy window
- row to frame row. */
+ /* Copy window row to frame row. */
bcopy (window_row->glyphs[0],
frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
window_matrix->matrix_w * sizeof (struct glyph));
}
else
{
- /* Copy W's desired matrix. */
-
+ xassert (window_row->enabled_p);
+
+ /* Only when a desired row has been displayed, we want
+ the corresponding frame row to be updated. */
+ frame_row->enabled_p = 1;
+
/* Maybe insert a vertical border between horizontally adjacent
windows. */
if (right_border_glyph)
SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph);
}
+#if 0 /* This shouldn't be necessary. Let's check it. */
/* Due to hooks installed, it normally doesn't happen that
window rows and frame rows of the same matrix are out of
sync, i.e. have a different understanding of where to
/* Exchange pointers between both rows. */
swap_glyph_pointers (window_row, slice_row);
}
+#endif
- /* Now, we are sure that window row window_y is a slice of
- the frame row frame_y. But, lets check that assumption. */
+ /* Window row window_y must be a slice of frame row
+ frame_y. */
xassert (glyph_row_slice_p (window_row, frame_row));
-
+
/* If rows are in sync, we don't have to copy glyphs because
frame and window share glyphs. */
+
+#if GLYPH_DEBUG
+ strcpy (w->current_matrix->method, w->desired_matrix->method);
+#endif
}
/* Set number of used glyphs in the frame matrix. Since we fill
frame_row->used[TEXT_AREA]
= window_matrix->matrix_x + window_matrix->matrix_w;
- /* Or in flags. */
- frame_row->enabled_p |= window_row->enabled_p;
+ /* Or in other flags. */
frame_row->inverse_p |= window_row->inverse_p;
/* Next row. */
{
struct glyph_row *current_row = MATRIX_ROW (current_matrix, row);
struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, row);
+ int mouse_face_p = current_row->mouse_face_p;
/* Do current_row = desired_row. This exchanges glyph pointers
between both rows, and does a structure assignment otherwise. */
/* Enable current_row to mark it as valid. */
current_row->enabled_p = 1;
+ current_row->mouse_face_p = mouse_face_p;
/* If we are called on frame matrices, perform analogous operations
for window matrices. */
= MATRIX_ROW (w->current_matrix, row);
struct glyph_row *desired_row
= MATRIX_ROW (w->desired_matrix, row);
-
- assign_row (current_row, desired_row);
+
+ if (desired_row->enabled_p)
+ assign_row (current_row, desired_row);
+ else
+ swap_glyph_pointers (desired_row, current_row);
current_row->enabled_p = 1;
}
}
}
+/* Synchronize glyph pointers in the current matrix of window W with
+ the current frame matrix. W must be full-width, and be on a tty
+ frame. */
+
+static void
+sync_window_with_frame_matrix_rows (w)
+ struct window *w;
+{
+ struct frame *f = XFRAME (w->frame);
+ struct glyph_row *window_row, *window_row_end, *frame_row;
+
+ /* Preconditions: W must be a leaf window and full-width. Its frame
+ must have a frame matrix. */
+ xassert (NILP (w->hchild) && NILP (w->vchild));
+ xassert (WINDOW_FULL_WIDTH_P (w));
+ xassert (!FRAME_WINDOW_P (f));
+
+ /* If W is a full-width window, glyph pointers in W's current matrix
+ have, by definition, to be the same as glyph pointers in the
+ corresponding frame matrix. */
+ window_row = w->current_matrix->rows;
+ window_row_end = window_row + w->current_matrix->nrows;
+ frame_row = f->current_matrix->rows + XFASTINT (w->top);
+ while (window_row < window_row_end)
+ {
+ int area;
+
+ for (area = LEFT_MARGIN_AREA; area <= LAST_AREA; ++area)
+ window_row->glyphs[area] = frame_row->glyphs[area];
+
+ ++window_row, ++frame_row;
+ }
+}
+
+
+/* Return the window in the window tree rooted in W containing frame
+ row ROW. Value is null if none is found. */
+
+struct window *
+frame_row_to_window (w, row)
+ struct window *w;
+ int row;
+{
+ struct window *found = NULL;
+
+ while (w && !found)
+ {
+ if (!NILP (w->hchild))
+ found = frame_row_to_window (XWINDOW (w->hchild), row);
+ else if (!NILP (w->vchild))
+ found = frame_row_to_window (XWINDOW (w->vchild), row);
+ else if (row >= XFASTINT (w->top)
+ && row < XFASTINT (w->top) + XFASTINT (w->height))
+ found = w;
+
+ w = NILP (w->next) ? 0 : XWINDOW (w->next);
+ }
+
+ return found;
+}
+
+
/* Perform a line dance in the window tree rooted at W, after
scrolling a frame matrix in mirrored_line_dance.
/* W is a leaf window, and we are working on its current
matrix m. */
struct glyph_matrix *m = w->current_matrix;
-
- int i;
-
+ int i, sync_p = 0;
struct glyph_row *old_rows;
/* Make a copy of the original rows of matrix m. */
int from_inside_window_p
= window_from >= 0 && window_from < m->matrix_h;
- if (from_inside_window_p)
+ /* Is assigned to line inside window? */
+ int to_inside_window_p
+ = window_to >= 0 && window_to < m->matrix_h;
+
+ if (from_inside_window_p && to_inside_window_p)
{
-#if GLYPH_DEBUG
- /* Is assigned to line inside window? */
- int to_inside_window_p
- = window_to >= 0 && window_to < m->matrix_h;
-#endif
-
/* Enabled setting before assignment. */
int enabled_before_p;
- /* If not both lines inside the window, we have a
- serious problem. */
- xassert (to_inside_window_p);
-
/* Do the assignment. The enabled_p flag is saved
over the assignment because the old redisplay did
that. */
if (!retained_p[copy_from[i]])
m->rows[window_to].enabled_p = 0;
}
+ else if (to_inside_window_p)
+ {
+ /* A copy between windows. This is an infrequent
+ case not worth optimizing. */
+ struct frame *f = XFRAME (w->frame);
+ struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
+ struct window *w2;
+ struct glyph_matrix *m2;
+ int m2_from;
+
+ w2 = frame_row_to_window (root, frame_to);
+ m2 = w2->current_matrix;
+ m2_from = frame_from - m2->matrix_y;
+ copy_row_except_pointers (m->rows + window_to,
+ m2->rows + m2_from);
+
+ /* If frame line is empty, window line is empty, too. */
+ if (!retained_p[copy_from[i]])
+ m->rows[window_to].enabled_p = 0;
+ sync_p = 1;
+ }
+ else if (from_inside_window_p)
+ sync_p = 1;
}
+
+ /* If there was a copy between windows, make sure glyph
+ pointers are in sync with the frame matrix. */
+ if (sync_p)
+ sync_window_with_frame_matrix_rows (w);
/* Check that no pointers are lost. */
CHECK_MATRIX (m);
direct_output_for_insert (g)
int g;
{
- register struct frame *f = selected_frame;
+ register struct frame *f = SELECTED_FRAME ();
struct window *w = XWINDOW (selected_window);
struct it it, it2;
struct glyph_row *glyph_row;
/* Give up if buffer appears in two places. */
|| buffer_shared > 1
/* Give up if w is mini-buffer and a message is being displayed there */
- || (MINI_WINDOW_P (w)
- && (echo_area_glyphs || STRINGP (echo_area_message)))
+ || (MINI_WINDOW_P (w) && !NILP (echo_area_buffer[0]))
/* Give up for hscrolled mini-buffer because display of the prompt
is handled specially there (see display_line). */
|| (MINI_WINDOW_P (w) && XFASTINT (w->hscroll))
position. */
clear_glyph_row (&scratch_glyph_row);
SET_TEXT_POS (pos, PT, PT_BYTE);
- DEC_TEXT_POS (pos);
+ DEC_TEXT_POS (pos, !NILP (current_buffer->enable_multibyte_characters));
init_iterator (&it, w, CHARPOS (pos), BYTEPOS (pos), &scratch_glyph_row,
DEFAULT_FACE_ID);
glyph_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+ if (glyph_row->mouse_face_p)
+ return 0;
/* Give up if highlighting trailing whitespace and we have trailing
whitespace in glyph_row. We would have to remove the trailing
whitespace face in that case. */
- if (it.show_trailing_whitespace_p
+ if (!NILP (Vshow_trailing_whitespace)
&& glyph_row->used[TEXT_AREA])
{
struct glyph *last;
last = glyph_row->glyphs[TEXT_AREA] + glyph_row->used[TEXT_AREA] - 1;
if (last->type == STRETCH_GLYPH
|| (last->type == CHAR_GLYPH
- && last->u.ch.code == ' '))
+ && last->u.ch == ' '))
return 0;
}
delta += 1;
delta_bytes += it.len;
- set_iterator_to_next (&it);
+ set_iterator_to_next (&it, 1);
}
/* Give up if we hit the right edge of the window. We would have
{
if (it2.c == '\t')
return 0;
- set_iterator_to_next (&it2);
+ set_iterator_to_next (&it2, 1);
}
/* Number of new glyphs produced. */
/* Make room for new glyphs, then insert them. */
xassert (end - glyphs - n >= 0);
- safe_bcopy (glyphs, glyphs + n, (end - glyphs - n) * sizeof (*end));
+ safe_bcopy ((char *) glyphs, (char *) (glyphs + n),
+ (end - glyphs - n) * sizeof (*end));
bcopy (it.glyph_row->glyphs[TEXT_AREA], glyphs, n * sizeof *glyphs);
glyph_row->used[TEXT_AREA] = min (glyph_row->used[TEXT_AREA] + n,
end - glyph_row->glyphs[TEXT_AREA]);
/* Increment buffer positions for glyphs following the newly
inserted ones. */
for (glyph = glyphs + n; glyph < end; ++glyph)
- if (glyph->charpos > 0)
+ if (glyph->charpos > 0 && BUFFERP (glyph->object))
glyph->charpos += delta;
if (MATRIX_ROW_END_CHARPOS (glyph_row) > 0)
}
/* Adjust positions in lines following the one we are in. */
- increment_glyph_matrix_buffer_positions (w->current_matrix,
- w->cursor.vpos + 1,
- w->current_matrix->nrows,
- delta, delta_bytes);
+ increment_matrix_positions (w->current_matrix,
+ w->cursor.vpos + 1,
+ w->current_matrix->nrows,
+ delta, delta_bytes);
glyph_row->contains_overlapping_glyphs_p
|= it.glyph_row->contains_overlapping_glyphs_p;
- if (it.show_trailing_whitespace_p)
+ glyph_row->displays_text_p = 1;
+ w->window_end_vpos = make_number (max (w->cursor.vpos,
+ XFASTINT (w->window_end_vpos)));
+
+ if (!NILP (Vshow_trailing_whitespace))
highlight_trailing_whitespace (it.f, glyph_row);
/* Write glyphs. If at end of row, we can simply call write_glyphs.
}
if (rif)
- rif->update_window_end_hook (w, 1);
+ rif->update_window_end_hook (w, 1, 0);
update_end (f);
updated_row = NULL;
fflush (stdout);
TRACE ((stderr, "direct output for insert\n"));
- unchanged_modified = MODIFF;
- beg_unchanged = GPT - BEG;
+ UNCHANGED_MODIFIED = MODIFF;
+ BEG_UNCHANGED = GPT - BEG;
XSETFASTINT (w->last_point, PT);
w->last_cursor = w->cursor;
XSETFASTINT (w->last_modified, MODIFF);
direct_output_forward_char (n)
int n;
{
- struct frame *f = selected_frame;
+ struct frame *f = SELECTED_FRAME ();
struct window *w = XWINDOW (selected_window);
struct glyph_row *row;
+ /* Give up if point moved out of or into a composition. */
+ if (check_point_in_composition (current_buffer, XINT (w->last_point),
+ current_buffer, PT))
+ return 0;
+
/* Give up if face attributes have been changed. */
if (face_change_count)
return 0;
if (!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active))
return 0;
+ /* Can't use direct output if highlighting trailing whitespace. */
+ if (!NILP (Vshow_trailing_whitespace))
+ return 0;
+
+ /* Give up if we are showing a message or just cleared the message
+ because we might need to resize the echo area window. */
+ if (!NILP (echo_area_buffer[0]) || !NILP (echo_area_buffer[1]))
+ return 0;
+
+ /* Give up if currently displaying a message instead of the
+ minibuffer contents. */
+ if (XWINDOW (minibuf_window) == w
+ && EQ (minibuf_window, echo_area_window))
+ return 0;
+
+ /* Give up if we don't know where the cursor is. */
+ if (w->cursor.vpos < 0)
+ return 0;
+
row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
+ /* Give up if PT is outside of the last known cursor row. */
if (PT <= MATRIX_ROW_START_BYTEPOS (row)
|| PT >= MATRIX_ROW_END_BYTEPOS (row))
return 0;
set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
+
w->last_cursor = w->cursor;
XSETFASTINT (w->last_point, PT);
update_window (XWINDOW (f->menu_bar_window), 1);
/* Update the tool-bar window, if present. */
- if (WINDOWP (f->toolbar_window))
+ if (WINDOWP (f->tool_bar_window))
{
Lisp_Object tem;
- struct window *w = XWINDOW (f->toolbar_window);
+ struct window *w = XWINDOW (f->tool_bar_window);
/* Update tool-bar window. */
if (w->must_be_updated_p)
/* Swap tool-bar strings. We swap because we want to
reuse strings. */
- tem = f->current_toolbar_string;
- f->current_toolbar_string = f->desired_toolbar_string;
- f->desired_toolbar_string = tem;
- f->n_current_toolbar_items = f->n_desired_toolbar_items;
+ tem = f->current_tool_bar_string;
+ f->current_tool_bar_string = f->desired_tool_bar_string;
+ f->desired_tool_bar_string = tem;
+ f->n_current_tool_bar_items = f->n_desired_tool_bar_items;
/* Swap tool-bar items. We swap because we want to
reuse vectors. */
- tem = f->current_toolbar_items;
- f->current_toolbar_items = f->desired_toolbar_items;
- f->desired_toolbar_items = tem;
+ tem = f->current_tool_bar_items;
+ f->current_tool_bar_items = f->desired_tool_bar_items;
+ f->desired_tool_bar_items = tem;
}
}
/* Update windows. */
paused_p = update_window_tree (root_window, force_p);
update_end (f);
- display_completed = !paused_p;
-
- /* The flush is a performance bottleneck under X. */
-#if 0
+
+#if 0 /* This flush is a performance bottleneck under X,
+ and it doesn't seem to be necessary anyway. */
rif->flush_display (f);
#endif
}
frame matrix we operate. */
set_frame_matrix_frame (f);
- /* Build F's desired matrix from window matrices. For windows
- whose must_be_updated_p flag is set, desired matrices are
- made part of the desired frame matrix. For other windows,
- the current matrix is copied. */
+ /* Build F's desired matrix from window matrices. */
build_frame_matrix (f);
- /* Do the update on the frame desired matrix. */
+ /* Update the display */
+ update_begin (f);
paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);
-
+ update_end (f);
+
+ if (termscript)
+ fflush (termscript);
+ fflush (stdout);
+
/* Check window matrices for lost pointers. */
IF_DEBUG (check_window_matrix_pointers (root_window));
}
/* Reset flags indicating that a window should be updated. */
set_window_update_flags (root_window, 0);
+
+ display_completed = !paused_p;
return paused_p;
}
struct window *w;
int yb;
{
- int i, bottom_y;
- struct glyph_row *row;
+ int i;
/* If rows overlapping others have been changed, the rows being
overlapped have to be redrawn. This won't draw lines that have
current rows is 0. */
for (i = 0; i < w->current_matrix->nrows; ++i)
{
- row = w->current_matrix->rows + i;
+ struct glyph_row *row = w->current_matrix->rows + i;
if (!row->enabled_p)
break;
row->overlapped_p = 0;
}
- bottom_y = MATRIX_ROW_BOTTOM_Y (row);
- if (bottom_y >= yb)
+ if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
break;
}
}
struct window *w;
int force_p;
{
- struct frame *f = XFRAME (WINDOW_FRAME (w));
struct glyph_matrix *desired_matrix = w->desired_matrix;
int paused_p;
int preempt_count = baud_rate / 2400 + 1;
extern int input_pending;
+#if GLYPH_DEBUG
+ struct frame *f = XFRAME (WINDOW_FRAME (w));
extern struct frame *updating_frame;
+#endif
/* Check that W's frame doesn't have glyph matrices. */
xassert (FRAME_WINDOW_P (f));
{
struct glyph_row *row, *end;
struct glyph_row *mode_line_row;
- struct glyph_row *top_line_row = NULL;
- int yb, changed_p = 0;
+ struct glyph_row *header_line_row = NULL;
+ int yb, changed_p = 0, mouse_face_overwritten_p = 0;
rif->update_window_begin_hook (w);
yb = window_text_bottom_y (w);
row = desired_matrix->rows;
end = row + desired_matrix->nrows - 1;
if (row->mode_line_p)
- top_line_row = row++;
+ header_line_row = row++;
/* Update the mode line, if necessary. */
mode_line_row = MATRIX_MODE_LINE_ROW (desired_matrix);
{
mode_line_row->y = yb;
update_window_line (w, MATRIX_ROW_VPOS (mode_line_row,
- desired_matrix));
+ desired_matrix),
+ &mouse_face_overwritten_p);
changed_p = 1;
}
while (row < end && !row->enabled_p)
++row;
- /* Try reusing part of the display by inserting/deleting lines. */
+ /* Try reusing part of the display by copying. */
if (row < end && !desired_matrix->no_scrolling_p)
{
- int rc = scrolling_window (w, top_line_row != NULL);
+ int rc = scrolling_window (w, header_line_row != NULL);
if (rc < 0)
{
/* All rows were found to be equal. */
/* Update the top mode line after scrolling because a new top
line would otherwise overwrite lines at the top of the window
that can be scrolled. */
- if (top_line_row && top_line_row->enabled_p)
+ if (header_line_row && header_line_row->enabled_p)
{
- top_line_row->y = 0;
- update_window_line (w, 0);
+ header_line_row->y = 0;
+ update_window_line (w, 0, &mouse_face_overwritten_p);
changed_p = 1;
}
/* Update the rest of the lines. */
for (; row < end && (force_p || !input_pending); ++row)
- if (row->enabled_p
- /* A row can be completely invisible in case a desired
- matrix was built with a vscroll and then
- make_cursor_line_fully_visible shifts the matrix. */
- && row->visible_height > 0)
+ if (row->enabled_p)
{
int vpos = MATRIX_ROW_VPOS (row, desired_matrix);
int i;
if (!force_p && vpos % preempt_count == 0)
detect_input_pending ();
- changed_p |= update_window_line (w, vpos);
+ changed_p |= update_window_line (w, vpos,
+ &mouse_face_overwritten_p);
/* Mark all rows below the last visible one in the current
matrix as invalid. This is necessary because of
set_cursor:
/* Fix the appearance of overlapping(overlapped rows. */
- if (rif->fix_overlapping_area
- && !w->pseudo_window_p
- && changed_p
- && !paused_p)
- {
- redraw_overlapped_rows (w, yb);
- redraw_overlapping_rows (w, yb);
- }
-
if (!paused_p && !w->pseudo_window_p)
{
+ if (changed_p && rif->fix_overlapping_area)
+ {
+ redraw_overlapped_rows (w, yb);
+ redraw_overlapping_rows (w, yb);
+ }
+
/* Make cursor visible at cursor position of W. */
set_window_cursor_after_update (w);
-#if 0
- /* Check that current matrix invariants are satisfied. This
- is for debugging only. See the comment around
- check_matrix_invariants. */
+#if 0 /* Check that current matrix invariants are satisfied. This is
+ for debugging only. See the comment of check_matrix_invariants. */
IF_DEBUG (check_matrix_invariants (w));
#endif
}
#endif
/* End of update of window W. */
- rif->update_window_end_hook (w, 1);
-
+ rif->update_window_end_hook (w, 1, mouse_face_overwritten_p);
}
else
paused_p = 1;
|| desired_row->phys_height != current_row->phys_height
|| desired_row->visible_height != current_row->visible_height
|| current_row->overlapped_p
+ || current_row->mouse_face_p
|| current_row->x != desired_row->x)
{
rif->cursor_to (vpos, 0, desired_row->y, desired_row->x);
changed. */
static int
-update_window_line (w, vpos)
+update_window_line (w, vpos, mouse_face_overwritten_p)
struct window *w;
- int vpos;
+ int vpos, *mouse_face_overwritten_p;
{
struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
int changed_p = 0;
- xassert (desired_row->enabled_p);
-
/* Set the row being updated. This is important to let xterm.c
know what line height values are in effect. */
updated_row = desired_row;
- /* Update display of the left margin area, if there is one. */
- if (!desired_row->full_width_p
- && !NILP (w->left_margin_width))
+ /* A row can be completely invisible in case a desired matrix was
+ built with a vscroll and then make_cursor_line_fully_visible shifts
+ the matrix. Make sure to make such rows current anyway, since
+ we need the correct y-position, for example, in the current matrix. */
+ if (desired_row->mode_line_p
+ || desired_row->visible_height > 0)
{
- update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
- changed_p = 1;
- }
-
- /* Update the display of the text area. */
- changed_p |= update_text_area (w, vpos);
-
- /* Update display of the right margin area, if there is one. */
- if (!desired_row->full_width_p
- && !NILP (w->right_margin_width))
- {
- changed_p = 1;
- update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
+ xassert (desired_row->enabled_p);
+
+ /* Update display of the left margin area, if there is one. */
+ if (!desired_row->full_width_p
+ && !NILP (w->left_margin_width))
+ {
+ changed_p = 1;
+ update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
+ }
+
+ /* Update the display of the text area. */
+ if (update_text_area (w, vpos))
+ {
+ changed_p = 1;
+ if (current_row->mouse_face_p)
+ *mouse_face_overwritten_p = 1;
+ }
+
+ /* Update display of the right margin area, if there is one. */
+ if (!desired_row->full_width_p
+ && !NILP (w->right_margin_width))
+ {
+ changed_p = 1;
+ update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
+ }
+
+ /* Draw truncation marks etc. */
+ if (!current_row->enabled_p
+ || desired_row->y != current_row->y
+ || desired_row->visible_height != current_row->visible_height
+ || desired_row->overlay_arrow_p != current_row->overlay_arrow_p
+ || desired_row->truncated_on_left_p != current_row->truncated_on_left_p
+ || desired_row->truncated_on_right_p != current_row->truncated_on_right_p
+ || desired_row->continued_p != current_row->continued_p
+ || desired_row->mode_line_p != current_row->mode_line_p
+ || (desired_row->indicate_empty_line_p
+ != current_row->indicate_empty_line_p)
+ || (MATRIX_ROW_CONTINUATION_LINE_P (desired_row)
+ != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))
+ rif->after_update_window_line_hook (desired_row);
}
- /* Draw truncation marks etc. */
- if (!current_row->enabled_p
- || desired_row->y != current_row->y
- || desired_row->visible_height != current_row->visible_height
- || desired_row->overlay_arrow_p != current_row->overlay_arrow_p
- || desired_row->truncated_on_left_p != current_row->truncated_on_left_p
- || desired_row->truncated_on_right_p != current_row->truncated_on_right_p
- || desired_row->continued_p != current_row->continued_p
- || desired_row->mode_line_p != current_row->mode_line_p
- || (desired_row->indicate_empty_line_p
- != current_row->indicate_empty_line_p)
- || (MATRIX_ROW_CONTINUATION_LINE_P (desired_row)
- != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))
- rif->after_update_window_line_hook (desired_row);
-
/* Update current_row from desired_row. */
make_current (w->desired_matrix, w->current_matrix, vpos);
updated_row = NULL;
/* Not intended for frame matrix updates. */
xassert (FRAME_WINDOW_P (f));
- if ((cursor_in_echo_area
- /* If we are showing a message instead of the mini-buffer,
- show the cursor for the message instead of for the
- (now hidden) mini-buffer contents. */
- || (XWINDOW (minibuf_window) == w
- && EQ (minibuf_window, echo_area_window)
- && (echo_area_glyphs || STRINGP (echo_area_message))))
+ if (cursor_in_echo_area
+ && !NILP (echo_area_buffer[0])
+ /* If we are showing a message instead of the mini-buffer,
+ show the cursor for the message instead. */
+ && XWINDOW (minibuf_window) == w
+ && EQ (minibuf_window, echo_area_window)
/* These cases apply only to the frame that contains
the active mini-buffer window. */
&& FRAME_HAS_MINIBUF_P (f)
line that has any text on it. Note: either all lines
are enabled or none. Otherwise we wouldn't be able to
determine Y. */
- struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0);
- int vpos, last_row_vpos;
- struct glyph_row *last_row = NULL;
+ struct glyph_row *row, *last_row;
+ struct glyph *glyph;
+ int yb = window_text_bottom_y (w);
+
+ last_row = NULL;
+ for (row = MATRIX_ROW (w->current_matrix, 0);
+ row->enabled_p;
+ ++row)
+ {
+ if (row->used[TEXT_AREA]
+ && row->glyphs[TEXT_AREA][0].charpos >= 0)
+ last_row = row;
- vpos = 0;
- while (vpos < w->current_matrix->nrows)
+ if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
+ break;
+ }
+
+ if (last_row)
{
- if (row->enabled_p && row->used[TEXT_AREA])
+ struct glyph *start = row->glyphs[TEXT_AREA];
+ struct glyph *last = start + row->used[TEXT_AREA] - 1;
+
+ while (last > start && last->charpos < 0)
+ --last;
+
+ for (glyph = start; glyph < last; ++glyph)
{
- last_row = row;
- last_row_vpos = vpos;
+ cx += glyph->pixel_width;
+ ++hpos;
}
- ++row;
- ++vpos;
- }
- if (last_row)
- {
- cx = last_row->pixel_width;
- hpos = last_row->used[TEXT_AREA];
cy = last_row->y;
- vpos = last_row_vpos;
+ vpos = MATRIX_ROW_VPOS (last_row, w->current_matrix);
}
}
}
}
+/* Set WINDOW->must_be_updated_p to ON_P for all windows in the window
+ tree rooted at W. */
+
+void
+set_window_update_flags (w, on_p)
+ struct window *w;
+ int on_p;
+{
+ while (w)
+ {
+ if (!NILP (w->hchild))
+ set_window_update_flags (XWINDOW (w->hchild), on_p);
+ else if (!NILP (w->vchild))
+ set_window_update_flags (XWINDOW (w->vchild), on_p);
+ else
+ w->must_be_updated_p = on_p;
+
+ w = NILP (w->next) ? 0 : XWINDOW (w->next);
+ }
+}
+
+
+\f
+/***********************************************************************
+ Window-Based Scrolling
+ ***********************************************************************/
+
+/* Structure describing rows in scrolling_window. */
+
+struct row_entry
+{
+ /* Number of occurrences of this row in desired and current matrix. */
+ int old_uses, new_uses;
+
+ /* Vpos of row in new matrix. */
+ int new_line_number;
+
+ /* Bucket index of this row_entry in the hash table row_table. */
+ int bucket;
+
+ /* The row described by this entry. */
+ struct glyph_row *row;
+
+ /* Hash collision chain. */
+ struct row_entry *next;
+};
+
+/* A pool to allocate row_entry structures from, and the size of the
+ pool. The pool is reallocated in scrolling_window when we find
+ that we need a larger one. */
+
+static struct row_entry *row_entry_pool;
+static int row_entry_pool_size;
+
+/* Index of next free entry in row_entry_pool. */
+
+static int row_entry_idx;
+
+/* The hash table used during scrolling, and the table's size. This
+ table is used to quickly identify equal rows in the desired and
+ current matrix. */
+
+static struct row_entry **row_table;
+static int row_table_size;
+
+/* Vectors of pointers to row_entry structures belonging to the
+ current and desired matrix, and the size of the vectors. */
+
+static struct row_entry **old_lines, **new_lines;
+static int old_lines_size, new_lines_size;
+
+/* A pool to allocate run structures from, and its size. */
+
+static struct run *run_pool;
+static int runs_size;
+
+/* A vector of runs of lines found during scrolling. */
+
+static struct run **runs;
+
+static struct row_entry *add_row_entry P_ ((struct window *,
+ struct glyph_row *));
+
+
+/* Add glyph row ROW to the scrolling hash table during the scrolling
+ of window W. */
+
+static INLINE struct row_entry *
+add_row_entry (w, row)
+ struct window *w;
+ struct glyph_row *row;
+{
+ struct row_entry *entry;
+ int i = row->hash % row_table_size;
+
+ entry = row_table[i];
+ while (entry && !row_equal_p (w, entry->row, row, 1))
+ entry = entry->next;
+
+ if (entry == NULL)
+ {
+ entry = row_entry_pool + row_entry_idx++;
+ entry->row = row;
+ entry->old_uses = entry->new_uses = 0;
+ entry->new_line_number = 0;
+ entry->bucket = i;
+ entry->next = row_table[i];
+ row_table[i] = entry;
+ }
+
+ return entry;
+}
+
+
/* Try to reuse part of the current display of W by scrolling lines.
- TOP_LINE_P non-zero means W has a top mode line.
+ HEADER_LINE_P non-zero means W has a top mode line.
The algorithm is taken from Communications of the ACM, Apr78 "A
Technique for Isolating Differences Between Files." It should take
1 if we did scroll. */
static int
-scrolling_window (w, top_line_p)
+scrolling_window (w, header_line_p)
struct window *w;
- int top_line_p;
+ int header_line_p;
{
- struct symbol
- {
- /* Number of occurrences of this line in old and new matrix. */
- short old_uses, new_uses;
-
- /* Vpos of line in new matrix. */
- short new_line_number;
-
- /* The line itself. */
- struct glyph_row *row;
-
- /* Hash collision chain. */
- struct symbol *next;
- };
-
- int SYMBOL_TABLE_SIZE = 101;
- struct symbol **table;
- struct symbol **old_line_syms, **new_line_syms;
- int i, j, first_old, first_new, last_old, last_new;
- struct symbol *sym;
- struct run **runs;
- int nruns;
struct glyph_matrix *desired_matrix = w->desired_matrix;
struct glyph_matrix *current_matrix = w->current_matrix;
int yb = window_text_bottom_y (w);
+ int i, j, first_old, first_new, last_old, last_new;
+ int nruns, nbytes, n, run_idx;
+ struct row_entry *entry;
/* Skip over rows equal at the start. */
- i = top_line_p ? 1 : 0;
- while (i < current_matrix->nrows - 1
- && MATRIX_ROW_ENABLED_P (current_matrix, i)
- && MATRIX_ROW_ENABLED_P (desired_matrix, i)
- && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (desired_matrix, i)) < yb
- && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (current_matrix, i)) < yb
- && row_equal_p (w,
- MATRIX_ROW (desired_matrix, i),
- MATRIX_ROW (current_matrix, i)))
+ for (i = header_line_p ? 1 : 0; i < current_matrix->nrows - 1; ++i)
{
- assign_row (MATRIX_ROW (current_matrix, i),
- MATRIX_ROW (desired_matrix, i));
- MATRIX_ROW (desired_matrix, i)->enabled_p = 0;
- ++i;
+ struct glyph_row *d = MATRIX_ROW (desired_matrix, i);
+ struct glyph_row *c = MATRIX_ROW (current_matrix, i);
+
+ if (c->enabled_p
+ && d->enabled_p
+ && c->y == d->y
+ && MATRIX_ROW_BOTTOM_Y (c) <= yb
+ && MATRIX_ROW_BOTTOM_Y (d) <= yb
+ && row_equal_p (w, c, d, 1))
+ {
+ assign_row (c, d);
+ d->enabled_p = 0;
+ }
+ else
+ break;
}
/* Give up if some rows in the desired matrix are not enabled. */
i = first_new + 1;
while (i < desired_matrix->nrows - 1
&& MATRIX_ROW (desired_matrix, i)->enabled_p
- && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (desired_matrix, i)) < yb)
+ && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (desired_matrix, i)) <= yb)
++i;
if (!MATRIX_ROW (desired_matrix, i)->enabled_p)
disabled. */
i = first_old + 1;
while (i < current_matrix->nrows - 1
- && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (current_matrix, i)) < yb)
+ && MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (current_matrix, i)) <= yb)
++i;
last_old = i;
== MATRIX_ROW (desired_matrix, j - 1)->y)
&& row_equal_p (w,
MATRIX_ROW (desired_matrix, i - 1),
- MATRIX_ROW (current_matrix, j - 1)))
+ MATRIX_ROW (current_matrix, j - 1), 1))
--i, --j;
last_new = i;
last_old = j;
if (last_new == first_new)
return 0;
- /* Allocate a hash table in which all rows will be inserted. */
- table = (struct symbol **) alloca (SYMBOL_TABLE_SIZE * sizeof *table);
- bzero (table, SYMBOL_TABLE_SIZE * sizeof *table);
-
- /* For each row in the current matrix, record the symbol belonging
- to the row in OLD_LINE_SYMS. */
- old_line_syms = (struct symbol **) alloca (current_matrix->nrows
- * sizeof *old_line_syms);
- new_line_syms = (struct symbol **) alloca (desired_matrix->nrows
- * sizeof *new_line_syms);
-
-#define ADDSYM(ROW) \
- do \
- { \
- struct glyph_row *row_ = (ROW); \
- int i_ = row_->hash % SYMBOL_TABLE_SIZE; \
- sym = table[i_]; \
- while (sym && !row_equal_p (w, sym->row, row_)) \
- sym = sym->next; \
- if (sym == NULL) \
- { \
- sym = (struct symbol *) alloca (sizeof *sym); \
- sym->row = row_; \
- sym->old_uses = sym->new_uses = 0; \
- sym->next = table[i_]; \
- table[i_] = sym; \
- } \
- } \
- while (0)
-
- /* Add current rows to the symbol table. */
+ /* Reallocate vectors, tables etc. if necessary. */
+
+ if (current_matrix->nrows > old_lines_size)
+ {
+ old_lines_size = current_matrix->nrows;
+ nbytes = old_lines_size * sizeof *old_lines;
+ old_lines = (struct row_entry **) xrealloc (old_lines, nbytes);
+ }
+
+ if (desired_matrix->nrows > new_lines_size)
+ {
+ new_lines_size = desired_matrix->nrows;
+ nbytes = new_lines_size * sizeof *new_lines;
+ new_lines = (struct row_entry **) xrealloc (new_lines, nbytes);
+ }
+
+ n = desired_matrix->nrows + current_matrix->nrows;
+ if (3 * n > row_table_size)
+ {
+ row_table_size = next_almost_prime (3 * n);
+ nbytes = row_table_size * sizeof *row_table;
+ row_table = (struct row_entry **) xrealloc (row_table, nbytes);
+ bzero (row_table, nbytes);
+ }
+
+ if (n > row_entry_pool_size)
+ {
+ row_entry_pool_size = n;
+ nbytes = row_entry_pool_size * sizeof *row_entry_pool;
+ row_entry_pool = (struct row_entry *) xrealloc (row_entry_pool, nbytes);
+ }
+
+ if (desired_matrix->nrows > runs_size)
+ {
+ runs_size = desired_matrix->nrows;
+ nbytes = runs_size * sizeof *runs;
+ runs = (struct run **) xrealloc (runs, nbytes);
+ nbytes = runs_size * sizeof *run_pool;
+ run_pool = (struct run *) xrealloc (run_pool, nbytes);
+ }
+
+ nruns = run_idx = 0;
+ row_entry_idx = 0;
+
+ /* Add rows from the current and desired matrix to the hash table
+ row_hash_table to be able to find equal ones quickly. */
+
for (i = first_old; i < last_old; ++i)
{
if (MATRIX_ROW (current_matrix, i)->enabled_p)
{
- ADDSYM (MATRIX_ROW (current_matrix, i));
- old_line_syms[i] = sym;
- ++sym->old_uses;
+ entry = add_row_entry (w, MATRIX_ROW (current_matrix, i));
+ old_lines[i] = entry;
+ ++entry->old_uses;
}
else
- old_line_syms[i] = NULL;
+ old_lines[i] = NULL;
}
- /* Add desired rows to the symbol table. */
for (i = first_new; i < last_new; ++i)
{
xassert (MATRIX_ROW_ENABLED_P (desired_matrix, i));
- ADDSYM (MATRIX_ROW (desired_matrix, i));
- ++sym->new_uses;
- new_line_syms[i] = sym;
- sym->new_line_number = i;
+ entry = add_row_entry (w, MATRIX_ROW (desired_matrix, i));
+ ++entry->new_uses;
+ entry->new_line_number = i;
+ new_lines[i] = entry;
}
-#undef ADDSYM
-
- /* Record in runs which moves were found, ordered by pixel
- height of copied areas. */
- nruns = 0;
- runs = (struct run **) alloca (desired_matrix->nrows * sizeof *runs);
-
/* Identify moves based on lines that are unique and equal
in both matrices. */
for (i = first_old; i < last_old;)
- if (old_line_syms[i]
- && old_line_syms[i]->old_uses == 1
- && old_line_syms[i]->new_uses == 1)
+ if (old_lines[i]
+ && old_lines[i]->old_uses == 1
+ && old_lines[i]->new_uses == 1)
{
int j, k;
- int new_line = old_line_syms[i]->new_line_number;
- struct run *run = (struct run *) alloca (sizeof *run);
+ int new_line = old_lines[i]->new_line_number;
+ struct run *run = run_pool + run_idx++;
/* Record move. */
run->current_vpos = i;
k = new_line - 1;
while (j > first_old
&& k > first_new
- && old_line_syms[j] == new_line_syms[k])
+ && old_lines[j] == new_lines[k])
{
int h = MATRIX_ROW (current_matrix, j)->height;
--run->current_vpos;
k = new_line + 1;
while (j < last_old
&& k < last_new
- && old_line_syms[j] == new_line_syms[k])
+ && old_lines[j] == new_lines[k])
{
int h = MATRIX_ROW (current_matrix, j)->height;
++run->nrows;
{
struct glyph_row *from, *to;
int to_overlapped_p;
-
+
to = MATRIX_ROW (current_matrix, r->desired_vpos + j);
- to_overlapped_p = to->overlapped_p;
from = MATRIX_ROW (desired_matrix, r->desired_vpos + j);
+ to_overlapped_p = to->overlapped_p;
assign_row (to, from);
to->enabled_p = 1, from->enabled_p = 0;
to->overlapped_p = to_overlapped_p;
}
}
+ /* Clear the hash table, for the next time. */
+ for (i = 0; i < row_entry_idx; ++i)
+ row_table[row_entry_pool[i].bucket] = NULL;
+
/* Value is non-zero to indicate that we scrolled the display. */
return 1;
}
-/* Set WINDOW->must_be_updated_p TO ON_P for all windows WINDOW in the
- window tree rooted at W. */
-
-void
-set_window_update_flags (w, on_p)
- struct window *w;
- int on_p;
-{
- while (w)
- {
- if (!NILP (w->hchild))
- set_window_update_flags (XWINDOW (w->hchild), on_p);
- else if (!NILP (w->vchild))
- set_window_update_flags (XWINDOW (w->vchild), on_p);
- else
- w->must_be_updated_p = on_p;
-
- w = NILP (w->next) ? 0 : XWINDOW (w->next);
- }
-}
-
-
\f
/************************************************************************
Frame-Based Updates
if (preempt_count <= 0)
preempt_count = 1;
- detect_input_pending ();
- if (input_pending && !force_p)
+ if (redisplay_dont_pause)
+ force_p = 1;
+ else if (!force_p && detect_input_pending ())
{
pause = 1;
goto do_pause;
}
- update_begin (f);
-
/* If we cannot insert/delete lines, it's no use trying it. */
if (!line_ins_del_ok)
inhibit_id_p = 1;
(now hidden) mini-buffer contents. */
|| (EQ (minibuf_window, selected_window)
&& EQ (minibuf_window, echo_area_window)
- && (echo_area_glyphs || STRINGP (echo_area_message))))
+ && !NILP (echo_area_buffer[0])))
/* These cases apply only to the frame that contains
the active mini-buffer window. */
&& FRAME_HAS_MINIBUF_P (f)
{
/* Frame rows are filled up with spaces that
must be ignored here. */
- int i;
struct glyph_row *r = MATRIX_ROW (current_matrix,
row);
struct glyph *start = r->glyphs[TEXT_AREA];
/* We have only one cursor on terminal frames. Use it to
display the cursor of the selected window. */
struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
- if (w->cursor.vpos >= 0)
+ if (w->cursor.vpos >= 0
+ /* The cursor vpos may be temporarily out of bounds
+ in the following situation: There is one window,
+ with the cursor in the lower half of it. The window
+ is split, and a message causes a redisplay before
+ a new cursor position has been computed. */
+ && w->cursor.vpos < XFASTINT (w->height))
{
int x = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos);
int y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
}
}
- update_end (f);
-
- if (termscript)
- fflush (termscript);
- fflush (stdout);
-
do_pause:
- display_completed = !pause;
clear_desired_matrices (f);
return pause;
}
while (p1 < end1
&& p2 < end2
- && GLYPH_FROM_CHAR_GLYPH (*p1) == GLYPH_FROM_CHAR_GLYPH (*p2))
+ && GLYPH_CHAR_AND_FACE_EQUAL_P (p1, p2))
++p1, ++p2;
return p1 - str1;
else
reassert_line_highlight (desired_row->inverse_p, vpos);
+ /* Current row not enabled means it has unknown contents. We must
+ write the whole desired line in that case. */
must_write_whole_line_p = !current_row->enabled_p;
if (must_write_whole_line_p)
{
- /* A line that is not enabled is empty. */
obody = 0;
olen = 0;
}
else
{
- /* A line not empty in the current matrix. */
obody = MATRIX_ROW_GLYPH_START (current_matrix, vpos);
olen = current_row->used[TEXT_AREA];
if (! current_row->inverse_p)
{
- /* Ignore trailing spaces. */
+ /* Ignore trailing spaces, if we can. */
if (!must_write_spaces)
while (olen > 0 && CHAR_GLYPH_SPACE_P (obody[olen-1]))
olen--;
}
else
{
- /* For an inverse-video line, remember we gave it spaces all
- the way to the frame edge so that the reverse video
- extends all the way across. */
+ /* For an inverse-video line, make sure it's filled with
+ spaces all the way to the frame edge so that the reverse
+ video extends all the way across. */
while (olen < FRAME_WIDTH (frame) - 1)
obody[olen++] = space_glyph;
}
/* If display line has unknown contents, write the whole line. */
if (must_write_whole_line_p)
{
- cursor_to (vpos, 0);
- write_glyphs (nbody, nlen);
- cursor_to (vpos, nlen);
- clear_end_of_line (-1);
+ /* Ignore spaces at the end, if we can. */
+ if (!must_write_spaces)
+ while (nlen > 0 && CHAR_GLYPH_SPACE_P (nbody[nlen - 1]))
+ --nlen;
+
+ /* Write the contents of the desired line. */
+ if (nlen)
+ {
+ cursor_to (vpos, 0);
+ write_glyphs (nbody, nlen);
+ }
+
+ /* Don't call clear_end_of_line if we already wrote the whole
+ line. The cursor will not be at the right margin in that
+ case but in the line below. */
+ if (nlen < FRAME_WINDOW_WIDTH (frame))
+ {
+ cursor_to (vpos, nlen);
+ clear_end_of_line (FRAME_WINDOW_WIDTH (frame));
+ }
+ else
+ /* Make sure we are in the right row, otherwise cursor movement
+ with cmgoto might use `ch' in the wrong row. */
+ cursor_to (vpos, 0);
+
make_current (desired_matrix, current_matrix, vpos);
return;
}
Lisp_Object
mode_line_string (w, x, y, mode_line_p, charpos)
struct window *w;
- int x, y;
+ int x, y, mode_line_p;
int *charpos;
{
struct glyph_row *row;
int x0;
Lisp_Object string = Qnil;
- /* Only do this for frames under a window system. */
- if (!FRAME_WINDOW_P (f))
- return Qnil;
-
if (mode_line_p)
row = MATRIX_MODE_LINE_ROW (w->current_matrix);
else
- row = MATRIX_TOP_LINE_ROW (w->current_matrix);
+ row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
if (row->mode_line_p && row->enabled_p)
{
and bitmap area width. */
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f))
x += FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f);
- x += FRAME_FLAGS_AREA_WIDTH (f);
+ x += FRAME_LEFT_FLAGS_AREA_WIDTH (f);
/* Find the glyph under X. If we find one with a string object,
it's the one we were looking for. */
int signalnum; /* some compilers complain in signal calls. */
{
int width, height;
+#ifndef USE_CRT_DLL
extern int errno;
+#endif
int old_errno = errno;
get_frame_size (&width, &height);
{
if (FRAME_TERMCAP_P (XFRAME (frame)))
{
- change_frame_size (XFRAME (frame), height, width, 0, 1);
+ change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
break;
}
}
#endif /* SIGWINCH */
-/* Do any change in frame size that was requested by a signal. */
+/* Do any change in frame size that was requested by a signal. SAFE
+ non-zero means this function is called from a place where it is
+ safe to change frame sizes while a redisplay is in progress. */
void
-do_pending_window_change ()
+do_pending_window_change (safe)
+ int safe;
{
/* If window_change_signal should have run before, run it now. */
+ if (redisplaying_p && !safe)
+ return;
+
while (delayed_size_change)
{
Lisp_Object tail, frame;
int width = FRAME_NEW_WIDTH (f);
if (height != 0 || width != 0)
- change_frame_size (f, height, width, 0, 0);
+ change_frame_size (f, height, width, 0, 0, safe);
}
}
}
If DELAY is non-zero, then assume we're being called from a signal
handler, and queue the change for later - perhaps the next
redisplay. Since this tries to resize windows, we can't call it
- from a signal handler. */
+ from a signal handler.
+
+ SAFE non-zero means this function is called from a place where it's
+ safe to change frame sizes while a redisplay is in progress. */
void
-change_frame_size (f, newheight, newwidth, pretend, delay)
+change_frame_size (f, newheight, newwidth, pretend, delay, safe)
register struct frame *f;
- int newheight, newwidth, pretend, delay;
+ int newheight, newwidth, pretend, delay, safe;
{
Lisp_Object tail, frame;
FOR_EACH_FRAME (tail, frame)
if (! FRAME_WINDOW_P (XFRAME (frame)))
change_frame_size_1 (XFRAME (frame), newheight, newwidth,
- pretend, delay);
+ pretend, delay, safe);
}
else
- change_frame_size_1 (f, newheight, newwidth, pretend, delay);
+ change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe);
}
static void
-change_frame_size_1 (f, newheight, newwidth, pretend, delay)
+change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe)
register struct frame *f;
- int newheight, newwidth, pretend, delay;
+ int newheight, newwidth, pretend, delay, safe;
{
int new_frame_window_width;
- unsigned int total_glyphs;
int count = specpdl_ptr - specpdl;
/* If we can't deal with the change now, queue it for later. */
- if (delay)
+ if (delay || (redisplaying_p && !safe))
{
FRAME_NEW_HEIGHT (f) = newheight;
FRAME_NEW_WIDTH (f) = newwidth;
if (FRAME_TERMCAP_P (f) && !pretend)
FrameCols = newwidth;
- if (WINDOWP (f->toolbar_window))
- XSETFASTINT (XWINDOW (f->toolbar_window)->width, newwidth);
+ if (WINDOWP (f->tool_bar_window))
+ XSETFASTINT (XWINDOW (f->tool_bar_window)->width, newwidth);
}
FRAME_HEIGHT (f) = newheight;
CHECK_NUMBER (milliseconds, 1);
usec = XINT (milliseconds) * 1000;
-#ifdef LISP_FLOAT_TYPE
{
double duration = extract_float (seconds);
sec = (int) duration;
usec += (duration - sec) * 1000000;
}
-#else
- CHECK_NUMBER (seconds, 0);
- sec = XINT (seconds);
-#endif
#ifndef EMACS_HAS_USECS
if (sec == 0 && usec != 0)
CHECK_NUMBER (milliseconds, 1);
usec = XINT (milliseconds) * 1000;
-#ifdef LISP_FLOAT_TYPE
{
double duration = extract_float (seconds);
sec = (int) duration;
usec += (duration - sec) * 1000000;
}
-#else
- CHECK_NUMBER (seconds, 0);
- sec = XINT (seconds);
-#endif
#ifndef EMACS_HAS_USECS
if (usec != 0 && sec == 0)
No need to test for the end of the vector
because the last element of the vector is lambda
and that will always cause a mismatch. */
- for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr)
+ for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
{
- buf = XCONS (XCONS (tail)->car)->cdr;
+ buf = XCDR (XCAR (tail));
/* Ignore buffers that aren't included in buffer lists. */
if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ')
continue;
n = 1;
FOR_EACH_FRAME (tail, frame)
n += 2;
- for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr)
+ for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
n += 3;
/* Reallocate the vector if it's grown, or if it's shrunk a lot. */
if (n > XVECTOR (frame_and_buffer_state)->size
*vecp++ = frame;
*vecp++ = XFRAME (frame)->name;
}
- for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr)
+ for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
{
- buf = XCONS (XCONS (tail)->car)->cdr;
+ buf = XCDR (XCAR (tail));
/* Ignore buffers that aren't included in buffer lists. */
if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ')
continue;
}
#endif /* HAVE_NTGUI */
+#ifdef macintosh
+ if (!inhibit_window_system)
+ {
+ Vwindow_system = intern ("mac");
+ Vwindow_system_version = make_number (1);
+ adjust_frame_glyphs_initially ();
+ return;
+ }
+#endif /* macintosh */
+
/* If no window system has been specified, try to use the terminal. */
if (! isatty (0))
{
term_init (terminal_type);
{
- int width = FRAME_WINDOW_WIDTH (selected_frame);
- int height = FRAME_HEIGHT (selected_frame);
+ struct frame *sf = SELECTED_FRAME ();
+ int width = FRAME_WINDOW_WIDTH (sf);
+ int height = FRAME_HEIGHT (sf);
unsigned int total_glyphs = height * (width + 2) * sizeof (struct glyph);
}
adjust_frame_glyphs_initially ();
- calculate_costs (selected_frame);
+ calculate_costs (XFRAME (selected_frame));
#ifdef SIGWINCH
#ifndef CANNOT_DUMP
&& (strcmp (terminal_type, "internal") != 0 || inhibit_window_system)
#endif
&& NILP (Vwindow_system))
- call0 (intern ("tty-set-up-initial-frame-faces"));
+ {
+ /* For the initial frame, we don't have any way of knowing what
+ are the foreground and background colors of the terminal. */
+ struct frame *sf = SELECTED_FRAME();
+
+ FRAME_FOREGROUND_PIXEL (sf) = FACE_TTY_DEFAULT_FG_COLOR;
+ FRAME_BACKGROUND_PIXEL (sf) = FACE_TTY_DEFAULT_BG_COLOR;
+ call0 (intern ("tty-set-up-initial-frame-faces"));
+ }
}
Blinking cursor
***********************************************************************/
-DEFUN ("show-cursor", Fshow_cursor, Sshow_cursor, 0, 2, 0,
- "Change visibility flag of the text cursor of WINDOW.\n\
-ON_P nil means toggle the flag. Otherwise, ON_P must be an integer,\n\
-and the flag is set according to the value of ON_P. WINDOW nil or\n\
-omitted means use the selected window. The new cursor state takes effect\n\
-with the next redisplay.")
- (on_p, window)
- Lisp_Object on_p, window;
+DEFUN ("internal-show-cursor", Finternal_show_cursor,
+ Sinternal_show_cursor, 2, 2, 0,
+ "Set the cursor-visibility flag of WINDOW to SHOW.\n\
+WINDOW nil means use the selected window. SHOW non-nil means\n\
+show a cursor in WINDOW in the next redisplay. SHOW nil means\n\
+don't show a cursor.")
+ (window, show)
+ Lisp_Object window, show;
{
- struct window *w;
-
/* Don't change cursor state while redisplaying. This could confuse
output routines. */
if (!redisplaying_p)
window = selected_window;
else
CHECK_WINDOW (window, 2);
- w = XWINDOW (window);
- if (NILP (on_p))
- w->cursor_off_p = !w->cursor_off_p;
- else
- {
- CHECK_NUMBER (on_p, 1);
- w->cursor_off_p = XINT (on_p) != 0;
- }
+ XWINDOW (window)->cursor_off_p = NILP (show);
}
return Qnil;
}
+DEFUN ("internal-show-cursor-p", Finternal_show_cursor_p,
+ Sinternal_show_cursor_p, 0, 1, 0,
+ "Value is non-nil if next redisplay will display a cursor in WINDOW.\n\
+WINDOW nil or omitted means report on the selected window.")
+ (window)
+ Lisp_Object window;
+{
+ struct window *w;
+
+ if (NILP (window))
+ window = selected_window;
+ else
+ CHECK_WINDOW (window, 2);
+
+ w = XWINDOW (window);
+ return w->cursor_off_p ? Qnil : Qt;
+}
+
\f
/***********************************************************************
Initialization
defsubr (&Ssit_for);
defsubr (&Ssleep_for);
defsubr (&Ssend_string_to_terminal);
- defsubr (&Sshow_cursor);
+ defsubr (&Sinternal_show_cursor);
+ defsubr (&Sinternal_show_cursor_p);
frame_and_buffer_state = Fmake_vector (make_number (20), Qlambda);
staticpro (&frame_and_buffer_state);
Qdisplay_table = intern ("display-table");
staticpro (&Qdisplay_table);
+ Qredisplay_dont_pause = intern ("redisplay-dont-pause");
+ staticpro (&Qredisplay_dont_pause);
DEFVAR_INT ("baud-rate", &baud_rate,
"*The output baud rate of the terminal.\n\