int auto_raise_tool_bar_buttons_p;
+/* Non-zero means to reposition window if cursor line is only partially visible. */
+
+int make_cursor_line_fully_visible_p;
+
/* Margin around tool bar buttons in pixels. */
Lisp_Object Vtool_bar_button_margin;
Lisp_Object Qtrailing_whitespace;
+/* Name and number of the face used to highlight escape glyphs. */
+
+Lisp_Object Qescape_glyph;
+int escape_glyph_face;
+
/* The symbol `image' which is the car of the lists used to represent
images in Lisp. */
#define CLEAR_FACE_CACHE_COUNT 500
static int clear_face_cache_count;
-/* Record the previous terminal frame we displayed. */
-
-static struct frame *previous_terminal_frame;
-
/* Non-zero while redisplay_internal is in progress. */
int redisplaying_p;
\f
/* Function prototypes. */
-static void setup_for_ellipsis P_ ((struct it *));
+static void setup_for_ellipsis P_ ((struct it *, int));
static void mark_window_display_accurate_1 P_ ((struct window *, int));
static int single_display_prop_string_p P_ ((Lisp_Object, Lisp_Object));
static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object));
static void reseat P_ ((struct it *, struct text_pos, int));
static void reseat_1 P_ ((struct it *, struct text_pos, int));
static void back_to_previous_visible_line_start P_ ((struct it *));
-static void reseat_at_previous_visible_line_start P_ ((struct it *));
+void reseat_at_previous_visible_line_start P_ ((struct it *));
static void reseat_at_next_visible_line_start P_ ((struct it *, int));
static int next_element_from_display_vector P_ ((struct it *));
static int next_element_from_string P_ ((struct it *));
/* If drawing a tool-bar window, draw it over the internal border
at the top of the window. */
- if (s->w == XWINDOW (s->f->tool_bar_window))
+ if (WINDOWP (s->f->tool_bar_window)
+ && s->w == XWINDOW (s->f->tool_bar_window))
r.y -= FRAME_INTERNAL_BORDER_WIDTH (s->f);
}
XSETWINDOW (it->window, w);
it->w = w;
it->f = XFRAME (w->frame);
-
+
/* Extra space between lines (on window systems only). */
if (base_face_id == DEFAULT_FACE_ID
&& FRAME_WINDOW_P (it->f))
* FRAME_LINE_HEIGHT (it->f));
else if (it->f->extra_line_spacing > 0)
it->extra_line_spacing = it->f->extra_line_spacing;
+ it->max_extra_line_spacing = 0;
}
/* If realized faces have been removed, e.g. because of face
attribute changes of named faces, recompute them. When running
- in batch mode, the face cache of Vterminal_frame is null. If
+ in batch mode, the face cache of the initial frame is null. If
we happen to get called, make a dummy face cache. */
- if (noninteractive && FRAME_FACE_CACHE (it->f) == NULL)
+ if (FRAME_FACE_CACHE (it->f) == NULL)
init_frame_faces (it->f);
if (FRAME_FACE_CACHE (it->f)->used == 0)
recompute_basic_faces (it->f);
it->stack[it->sp - 1].display_ellipsis_p = display_ellipsis_p;
}
else if (display_ellipsis_p)
- setup_for_ellipsis (it);
+ setup_for_ellipsis (it, 0);
}
}
}
-/* Make iterator IT return `...' next. */
+/* Make iterator IT return `...' next.
+ Replaces LEN characters from buffer. */
static void
-setup_for_ellipsis (it)
+setup_for_ellipsis (it, len)
struct it *it;
+ int len;
{
- if (it->dp
- && VECTORP (DISP_INVIS_VECTOR (it->dp)))
+ /* Use the display table definition for `...'. Invalid glyphs
+ will be handled by the method returning elements from dpvec. */
+ if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp)))
{
struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
it->dpvec = v->contents;
it->dpend = default_invis_vector + 3;
}
- /* The ellipsis display does not replace the display of the
- character at the new position. Indicate this by setting
- IT->dpvec_char_len to zero. */
- it->dpvec_char_len = 0;
-
+ it->dpvec_char_len = len;
it->current.dpvec_index = 0;
+
+ /* Remember the current face id in case glyphs specify faces.
+ IT's face is restored in set_iterator_to_next. */
+ it->saved_face_id = it->face_id;
it->method = next_element_from_display_vector;
}
&& CONSP (XCDR (prop)))
{
/* `(raise FACTOR)'. */
- if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+ if (!FRAME_WINDOW_P (it->f))
return 0;
#ifdef HAVE_WINDOW_SYSTEM
|| EQ (XCAR (prop), Qright_fringe))
&& CONSP (XCDR (prop)))
{
- unsigned face_id = DEFAULT_FACE_ID;
+ int face_id = DEFAULT_FACE_ID;
int fringe_bitmap;
/* Save current settings of IT so that we can restore them
when we are finished with the glyph property value. */
/* `(left-fringe BITMAP FACE)'. */
- if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f))
+ if (!FRAME_WINDOW_P (it->f))
return 0;
#ifdef HAVE_WINDOW_SYSTEM
if (CONSP (XCDR (XCDR (prop))))
{
Lisp_Object face_name = XCAR (XCDR (XCDR (prop)));
-
- face_id = lookup_named_face (it->f, face_name, 'A');
- if (face_id < 0)
- return 0;
+ int face_id2 = lookup_named_face (it->f, face_name, 'A', 0);
+ if (face_id2 >= 0)
+ face_id = face_id2;
}
push_it (it);
valid_p = (STRINGP (value)
#ifdef HAVE_WINDOW_SYSTEM
- || (!FRAME_TERMCAP_P (it->f) && valid_image_p (value))
+ || (FRAME_WINDOW_P (it->f) && valid_image_p (value))
#endif /* not HAVE_WINDOW_SYSTEM */
|| (CONSP (value) && EQ (XCAR (value), Qspace)));
#ifdef HAVE_WINDOW_SYSTEM
else
{
- it->what = IT_IMAGE;
- it->image_id = lookup_image (it->f, value);
- it->position = start_pos;
- it->object = NILP (object) ? it->w->buffer : object;
- it->method = next_element_from_image;
+ if (FRAME_WINDOW_P (it->f))
+ {
+ it->what = IT_IMAGE;
+ it->image_id = lookup_image (it->f, value);
+ it->position = start_pos;
+ it->object = NILP (object) ? it->w->buffer : object;
+ it->method = next_element_from_image;
+ }
/* Say that we haven't consumed the characters with
`display' property yet. The call to pop_it in
/* If we have to display `...' for invisible text, set
the iterator up for that. */
if (display_ellipsis_p)
- setup_for_ellipsis (it);
+ setup_for_ellipsis (it, 0);
}
else
{
{
Lisp_Object prop;
- prop = Fget_char_property (make_number (IT_CHARPOS (*it)),
+ /* Check the newline before point for invisibility. */
+ prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
Qinvisible, it->window);
if (TEXT_PROP_MEANS_INVISIBLE (prop))
visible_p = 0;
selective display. At the end, update IT's overlay information,
face information etc. */
-static void
+void
reseat_at_previous_visible_line_start (it)
struct it *it;
{
we hit the end of what we iterate over. Performance note: the
function pointer `method' used here turns out to be faster than
using a sequence of if-statements. */
- int success_p = (*it->method) (it);
+ int success_p;
+
+ get_next:
+ success_p = (*it->method) (it);
if (it->what == IT_CHARACTER)
{
it->dpvec = v->contents;
it->dpend = v->contents + v->size;
it->current.dpvec_index = 0;
+ it->saved_face_id = it->face_id;
it->method = next_element_from_display_vector;
- success_p = get_next_display_element (it);
}
else
{
set_iterator_to_next (it, 0);
- success_p = get_next_display_element (it);
}
+ goto get_next;
}
/* Translate control characters into `\003' or `^C' form.
translated to octal form. */
else if ((it->c < ' '
&& (it->area != TEXT_AREA
+ /* In mode line, treat \n like other crl chars. */
+ || (it->c != '\n'
+ && it->glyph_row && it->glyph_row->mode_line_p)
|| (it->c != '\n' && it->c != '\t')))
|| (it->multibyte_p
? ((it->c >= 127
&& it->len == 1)
- || !CHAR_PRINTABLE_P (it->c))
+ || !CHAR_PRINTABLE_P (it->c)
+ || it->c == 0x8ad
+ || it->c == 0x8a0)
: (it->c >= 127
&& (!unibyte_display_via_language_environment
|| it->c == unibyte_char_to_multibyte (it->c)))))
IT->ctl_chars with glyphs for what we have to
display. Then, set IT->dpvec to these glyphs. */
GLYPH g;
+ int ctl_len;
+ int face_id = escape_glyph_face;
+
+ /* Find the face id if `escape-glyph' unless we recently did. */
+ if (face_id < 0)
+ {
+ Lisp_Object tem = Fget (Qescape_glyph, Qface);
+ if (INTEGERP (tem))
+ face_id = XINT (tem);
+ else
+ face_id = 0;
+ /* If there's overflow, use 0 instead. */
+ if (FAST_GLYPH_FACE (FAST_MAKE_GLYPH (0, face_id)) != face_id)
+ face_id = 0;
+ escape_glyph_face = face_id;
+ }
if (it->c < 128 && it->ctl_arrow_p)
{
&& GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (it->dp))))
g = XINT (DISP_CTRL_GLYPH (it->dp));
else
- g = FAST_MAKE_GLYPH ('^', 0);
+ g = FAST_MAKE_GLYPH ('^', face_id);
XSETINT (it->ctl_chars[0], g);
- g = FAST_MAKE_GLYPH (it->c ^ 0100, 0);
+ g = FAST_MAKE_GLYPH (it->c ^ 0100, face_id);
XSETINT (it->ctl_chars[1], g);
+ ctl_len = 2;
+ }
+ else if (it->c == 0x8a0 || it->c == 0x8ad)
+ {
+ /* Set IT->ctl_chars[0] to the glyph for `\\'. */
+ if (it->dp
+ && INTEGERP (DISP_ESCAPE_GLYPH (it->dp))
+ && GLYPH_CHAR_VALID_P (XINT (DISP_ESCAPE_GLYPH (it->dp))))
+ g = XINT (DISP_ESCAPE_GLYPH (it->dp));
+ else
+ g = FAST_MAKE_GLYPH ('\\', face_id);
+ XSETINT (it->ctl_chars[0], g);
- /* Set up IT->dpvec and return first character from it. */
- it->dpvec_char_len = it->len;
- it->dpvec = it->ctl_chars;
- it->dpend = it->dpvec + 2;
- it->current.dpvec_index = 0;
- it->method = next_element_from_display_vector;
- get_next_display_element (it);
+ g = FAST_MAKE_GLYPH (it->c == 0x8ad ? '-' : ' ', face_id);
+ XSETINT (it->ctl_chars[1], g);
+ ctl_len = 2;
}
else
{
&& GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp))))
escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp));
else
- escape_glyph = FAST_MAKE_GLYPH ('\\', 0);
+ escape_glyph = FAST_MAKE_GLYPH ('\\', face_id);
if (SINGLE_BYTE_CHAR_P (it->c))
str[0] = it->c, len = 1;
XSETINT (it->ctl_chars[i * 4], escape_glyph);
/* Insert three more glyphs into IT->ctl_chars for
the octal display of the character. */
- g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0', 0);
+ g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0',
+ face_id);
XSETINT (it->ctl_chars[i * 4 + 1], g);
- g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0', 0);
+ g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0',
+ face_id);
XSETINT (it->ctl_chars[i * 4 + 2], g);
- g = FAST_MAKE_GLYPH ((str[i] & 7) + '0', 0);
+ g = FAST_MAKE_GLYPH ((str[i] & 7) + '0',
+ face_id);
XSETINT (it->ctl_chars[i * 4 + 3], g);
}
-
- /* Set up IT->dpvec and return the first character
- from it. */
- it->dpvec_char_len = it->len;
- it->dpvec = it->ctl_chars;
- it->dpend = it->dpvec + len * 4;
- it->current.dpvec_index = 0;
- it->method = next_element_from_display_vector;
- get_next_display_element (it);
+ ctl_len = len * 4;
}
+
+ /* Set up IT->dpvec and return first character from it. */
+ it->dpvec_char_len = it->len;
+ it->dpvec = it->ctl_chars;
+ it->dpend = it->dpvec + ctl_len;
+ it->current.dpvec_index = 0;
+ it->saved_face_id = it->face_id;
+ it->method = next_element_from_display_vector;
+ goto get_next;
}
}
it->dpvec = NULL;
it->current.dpvec_index = -1;
+ /* Recheck faces after display vector */
+ it->stop_charpos = 0;
+
/* Skip over characters which were displayed via IT->dpvec. */
if (it->dpvec_char_len < 0)
reseat_at_next_visible_line_start (it, 1);
&& IT_STRING_CHARPOS (*it) >= 0));
}
-
/* Load IT's display element fields with information about the next
display element which comes from a display table entry or from the
result of translating a control character to one of the forms `^C'
- or `\003'. IT->dpvec holds the glyphs to return as characters. */
+ or `\003'.
+
+ IT->dpvec holds the glyphs to return as characters.
+ IT->saved_face_id holds the face id before the display vector--
+ it is restored into IT->face_idin set_iterator_to_next. */
static int
next_element_from_display_vector (it)
/* Precondition. */
xassert (it->dpvec && it->current.dpvec_index >= 0);
- /* Remember the current face id in case glyphs specify faces.
- IT's face is restored in set_iterator_to_next. */
- it->saved_face_id = it->face_id;
-
if (INTEGERP (*it->dpvec)
&& GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec)))
{
struct it *it;
{
if (it->selective_display_ellipsis_p)
- {
- if (it->dp && VECTORP (DISP_INVIS_VECTOR (it->dp)))
- {
- /* Use the display table definition for `...'. Invalid glyphs
- will be handled by the method returning elements from dpvec. */
- struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
- it->dpvec_char_len = it->len;
- it->dpvec = v->contents;
- it->dpend = v->contents + v->size;
- it->current.dpvec_index = 0;
- it->method = next_element_from_display_vector;
- }
- else
- {
- /* Use default `...' which is stored in default_invis_vector. */
- it->dpvec_char_len = it->len;
- it->dpvec = default_invis_vector;
- it->dpend = default_invis_vector + 3;
- it->current.dpvec_index = 0;
- it->method = next_element_from_display_vector;
- }
- }
+ setup_for_ellipsis (it, it->len);
else
{
/* The face at the current position may be different from the
{
int nlines, h;
struct it it2, it3;
- int start_pos = IT_CHARPOS (*it);
+ int start_pos;
+ move_further_back:
xassert (dy >= 0);
+ start_pos = IT_CHARPOS (*it);
+
/* Estimate how many newlines we must move back. */
nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f));
a line height of 13 pixels each, recentering with point
on the bottom line will try to move -39/2 = 19 pixels
backward. Try to avoid moving into the first line. */
- && it->current_y - target_y > line_height / 3 * 2
+ && it->current_y - target_y > line_height * 2 / 3
&& IT_CHARPOS (*it) > BEGV)
{
TRACE_MOVE ((stderr, " not far enough -> move_vert %d\n",
target_y - it->current_y));
- move_it_vertically (it, target_y - it->current_y);
- xassert (IT_CHARPOS (*it) >= BEGV);
+ dy = it->current_y - target_y;
+ goto move_further_back;
}
else if (target_y >= it->current_y + line_height
&& IT_CHARPOS (*it) < ZV)
{
if (dy <= 0)
move_it_vertically_backward (it, -dy);
- else if (dy > 0)
+ else
{
TRACE_MOVE ((stderr, "move_it_v: from %d, %d\n", IT_CHARPOS (*it), dy));
move_it_to (it, ZV, -1, it->current_y + dy, -1,
/* DVPOS == 0 means move to the start of the screen line. */
move_it_vertically_backward (it, 0);
xassert (it->current_x == 0 && it->hpos == 0);
+ /* Let next call to line_bottom_y calculate real line height */
+ last_height = 0;
}
else if (dvpos > 0)
move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS);
bcopy (SDATA (msg), buffer, len);
message_dolog (buffer, len - 1, 1, 0);
- SAFE_FREE (len);
+ SAFE_FREE ();
UNGCPRO;
}
do_pending_window_change (0);
echo_area_display (1);
do_pending_window_change (0);
- if (frame_up_to_date_hook != 0 && ! gc_in_progress)
- (*frame_up_to_date_hook) (f);
+ if (FRAME_DISPLAY (f)->frame_up_to_date_hook != 0 && ! gc_in_progress)
+ (*FRAME_DISPLAY (f)->frame_up_to_date_hook) (f);
}
}
struct gcpro gcpro1;
GCPRO1 (m);
+ clear_message (1,1);
/* First flush out any partial line written with print. */
message_log_maybe_newline ();
do_pending_window_change (0);
echo_area_display (1);
do_pending_window_change (0);
- if (frame_up_to_date_hook != 0 && ! gc_in_progress)
- (*frame_up_to_date_hook) (f);
+ if (FRAME_DISPLAY (f)->frame_up_to_date_hook != 0 && ! gc_in_progress)
+ (*FRAME_DISPLAY (f)->frame_up_to_date_hook) (f);
}
}
height = it.current_y + last_height;
else
height = it.current_y + it.max_ascent + it.max_descent;
- height -= it.extra_line_spacing;
+ height -= min (it.extra_line_spacing, it.max_extra_line_spacing);
height = (height + unit - 1) / unit;
}
{
Lisp_Object tail, frame;
int changed_count = 0;
-
+
FOR_EACH_FRAME (tail, frame)
{
struct frame *f = XFRAME (frame);
-
+
if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f))
{
if (f->resized_p)
f->resized_p = 0;
}
}
-
+
frame_garbaged = 0;
if (changed_count)
++windows_or_buffers_changed;
/* The terminal frame is used as the first Emacs frame on the Mac OS. */
#ifndef MAC_OS8
#ifdef HAVE_WINDOW_SYSTEM
- /* When Emacs starts, selected_frame may be a visible terminal
- frame, even if we run under a window system. If we let this
- through, a message would be displayed on the terminal. */
- if (EQ (selected_frame, Vterminal_frame)
- && !NILP (Vwindow_system))
+ /* When Emacs starts, selected_frame may be the initial terminal
+ frame. If we let this through, a message would be displayed on
+ the terminal. */
+ if (FRAME_INITIAL_P (XFRAME (selected_frame)))
return 0;
#endif /* HAVE_WINDOW_SYSTEM */
#endif
Can do with a display update of the echo area,
unless we displayed some mode lines. */
update_single_window (w, 1);
- rif->flush_display (f);
+ FRAME_RIF (f)->flush_display (f);
}
else
update_frame (f, 1, 1);
/* Copy at most PRECISION chars from STR. */
nbytes = strlen (str);
- n+= c_string_width (str, nbytes, precision, &dummy, &nbytes);
+ n += c_string_width (str, nbytes, precision, &dummy, &nbytes);
while (nbytes--)
store_frame_title_char (*str++);
{
BLOCK_INPUT;
display_and_set_cursor (w, 1, hpos, vpos, x, y);
- if (rif->flush_display_optional)
- rif->flush_display_optional (SELECTED_FRAME ());
+ if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional)
+ FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ());
UNBLOCK_INPUT;
}
}
{
struct buffer *prev = current_buffer;
int count = SPECPDL_INDEX ();
- Lisp_Object old_tool_bar;
+ Lisp_Object new_tool_bar;
+ int new_n_tool_bar;
struct gcpro gcpro1;
/* Set current_buffer to the buffer of the selected
specbind (Qoverriding_local_map, Qnil);
}
- old_tool_bar = f->tool_bar_items;
- GCPRO1 (old_tool_bar);
+ GCPRO1 (new_tool_bar);
/* Build desired tool-bar items from keymaps. */
- BLOCK_INPUT;
- f->tool_bar_items
- = tool_bar_items (f->tool_bar_items, &f->n_tool_bar_items);
- UNBLOCK_INPUT;
+ new_tool_bar = tool_bar_items (Fcopy_sequence (f->tool_bar_items),
+ &new_n_tool_bar);
/* Redisplay the tool-bar if we changed it. */
- if (! NILP (Fequal (old_tool_bar, f->tool_bar_items)))
- w->update_mode_line = Qt;
+ if (NILP (Fequal (new_tool_bar, f->tool_bar_items)))
+ {
+ /* Redisplay that happens asynchronously due to an expose event
+ may access f->tool_bar_items. Make sure we update both
+ variables within BLOCK_INPUT so no such event interrupts. */
+ BLOCK_INPUT;
+ f->tool_bar_items = new_tool_bar;
+ f->n_tool_bar_items = new_n_tool_bar;
+ w->update_mode_line = Qt;
+ UNBLOCK_INPUT;
+ }
UNGCPRO;
{
row->height = row->phys_height = it->last_visible_y - row->y;
row->ascent = row->phys_ascent = 0;
+ row->extra_line_spacing = 0;
}
row->full_width_p = 1;
if (face_change_count)
++windows_or_buffers_changed;
- if (! FRAME_WINDOW_P (sf)
- && previous_terminal_frame != sf)
+ if (FRAME_TERMCAP_P (sf)
+ && FRAME_TTY (sf)->previous_terminal_frame != sf)
{
- /* Since frames on an ASCII terminal share the same display
- area, displaying a different frame means redisplay the whole
- thing. */
+ /* Since frames on a single ASCII terminal share the same
+ display area, displaying a different frame means redisplay
+ the whole thing. */
windows_or_buffers_changed++;
SET_FRAME_GARBAGED (sf);
- XSETFRAME (Vterminal_frame, sf);
+ FRAME_TTY (sf)->previous_terminal_frame = sf;
}
- previous_terminal_frame = sf;
/* Set the visible flags for all frames. Do this before checking
for resized or garbaged frames; they want to know if their frames
}
}
+
/* Notice any pending interrupt request to change frame size. */
do_pending_window_change (1);
{
struct frame *f = XFRAME (frame);
- if (FRAME_WINDOW_P (f) || f == sf)
+ if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
{
if (! EQ (frame, selected_frame))
/* Select the frame, for the sake of frame-local
/* Mark all the scroll bars to be removed; we'll redeem
the ones we want when we redisplay their windows. */
- if (condemn_scroll_bars_hook)
- condemn_scroll_bars_hook (f);
+ if (FRAME_DISPLAY (f)->condemn_scroll_bars_hook)
+ FRAME_DISPLAY (f)->condemn_scroll_bars_hook (f);
if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
redisplay_windows (FRAME_ROOT_WINDOW (f));
/* Any scroll bars which redisplay_windows should have
nuked should now go away. */
- if (judge_scroll_bars_hook)
- judge_scroll_bars_hook (f);
+ if (FRAME_DISPLAY (f)->judge_scroll_bars_hook)
+ FRAME_DISPLAY (f)->judge_scroll_bars_hook (f);
/* If fonts changed, display again. */
/* ??? rms: I suspect it is a mistake to jump all the way
{
struct frame *f = updated[i];
mark_window_display_accurate (f->root_window, 1);
- if (frame_up_to_date_hook)
- frame_up_to_date_hook (f);
+ if (FRAME_DISPLAY (f)->frame_up_to_date_hook)
+ FRAME_DISPLAY (f)->frame_up_to_date_hook (f);
}
}
}
/* Say overlay arrows are up to date. */
update_overlay_arrows (1);
- if (frame_up_to_date_hook != 0)
- frame_up_to_date_hook (sf);
+ if (FRAME_DISPLAY (sf)->frame_up_to_date_hook != 0)
+ FRAME_DISPLAY (sf)->frame_up_to_date_hook (sf);
}
update_mode_lines = 0;
else
redisplay_internal (1);
- if (rif != NULL && rif->flush_display_optional)
- rif->flush_display_optional (NULL);
+ if (FRAME_RIF (SELECTED_FRAME ()) != NULL
+ && FRAME_RIF (SELECTED_FRAME ())->flush_display_optional)
+ FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (NULL);
}
struct glyph_row *row;
int window_height;
+ if (!make_cursor_line_fully_visible_p)
+ return 1;
+
/* It's not always possible to find the cursor, e.g, when a window
is full of overlay strings. Don't do anything in that case. */
if (w->cursor.vpos < 0)
row = MATRIX_ROW (matrix, w->cursor.vpos);
/* If the cursor row is not partially visible, there's nothing to do. */
- if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row))
+ if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row))
return 1;
/* If the row the cursor is in is taller than the window's height,
{
start_display (&it, w, scroll_margin_pos);
if (this_scroll_margin)
- move_it_vertically (&it, - this_scroll_margin);
+ move_it_vertically_backward (&it, this_scroll_margin);
if (extra_scroll_margin_lines)
move_it_by_lines (&it, - extra_scroll_margin_lines, 0);
scroll_margin_pos = it.current.pos;
if (amount_to_scroll <= 0)
return SCROLLING_FAILED;
- move_it_vertically (&it, - amount_to_scroll);
+ move_it_vertically_backward (&it, amount_to_scroll);
startp = it.current.pos;
}
}
/* if PT is not in the glyph row, give up. */
rc = CURSOR_MOVEMENT_MUST_SCROLL;
}
- else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (row))
+ else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
+ && make_cursor_line_fully_visible_p)
{
if (PT == MATRIX_ROW_END_CHARPOS (row)
&& !row->ends_at_zv_p
start = end = whole = 0;
/* Indicate what this scroll bar ought to be displaying now. */
- set_vertical_scroll_bar_hook (w, end - start, whole, start);
+ if (FRAME_DISPLAY (XFRAME (w->frame))->set_vertical_scroll_bar_hook)
+ (*FRAME_DISPLAY (XFRAME (w->frame))->set_vertical_scroll_bar_hook)
+ (w, end - start, whole, start);
}
*w->desired_matrix->method = 0;
#endif
+ /* Force this to be looked up again for each redisp of each window. */
+ escape_glyph_face = -1;
+
specbind (Qinhibit_point_motion_hooks, Qt);
reconsider_clip_changes (w, buffer);
if (it.current_y <= 0)
{
init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
- move_it_vertically (&it, 0);
+ move_it_vertically_backward (&it, 0);
xassert (IT_CHARPOS (it) <= PT);
it.current_y = 0;
}
display_menu_bar (w);
#ifdef HAVE_WINDOW_SYSTEM
+ if (FRAME_WINDOW_P (f))
+ {
#ifdef USE_GTK
- redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f);
+ redisplay_tool_bar_p = FRAME_EXTERNAL_TOOL_BAR (f);
#else
- redisplay_tool_bar_p = WINDOWP (f->tool_bar_window)
- && (FRAME_TOOL_BAR_LINES (f) > 0
- || auto_resize_tool_bars_p);
-
+ redisplay_tool_bar_p = WINDOWP (f->tool_bar_window)
+ && (FRAME_TOOL_BAR_LINES (f) > 0
+ || auto_resize_tool_bars_p);
#endif
- if (redisplay_tool_bar_p)
- redisplay_tool_bar (f);
+ if (redisplay_tool_bar_p)
+ redisplay_tool_bar (f);
+ }
#endif
}
/* Note that we actually used the scroll bar attached to this
window, so it shouldn't be deleted at the end of redisplay. */
- redeem_scroll_bar_hook (w);
+ if (FRAME_DISPLAY (f)->redeem_scroll_bar_hook)
+ (*FRAME_DISPLAY (f)->redeem_scroll_bar_hook) (w);
}
/* Restore current_buffer and value of point in it. */
/* Give up if old or new display is scrolled vertically. We could
make this function handle this, but right now it doesn't. */
start_row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
- if (w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (start_row))
+ if (w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row))
return 0;
/* The variable new_start now holds the new window start. The old
start = start_row->start.pos;
/* If there are no more rows to try, or just one, give up. */
if (start_row == MATRIX_MODE_LINE_ROW (w->current_matrix) - 1
- || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (start_row)
+ || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row)
|| CHARPOS (start) == ZV)
{
clear_glyph_matrix (w->desired_matrix);
if (run.height > 0 && run.current_y != run.desired_y)
{
update_begin (f);
- rif->update_window_begin_hook (w);
- rif->clear_window_mouse_face (w);
- rif->scroll_run_hook (w, &run);
- rif->update_window_end_hook (w, 0, 0);
+ FRAME_RIF (f)->update_window_begin_hook (w);
+ FRAME_RIF (f)->clear_window_mouse_face (w);
+ FRAME_RIF (f)->scroll_run_hook (w, &run);
+ FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
update_end (f);
}
if (run.height)
{
update_begin (f);
- rif->update_window_begin_hook (w);
- rif->clear_window_mouse_face (w);
- rif->scroll_run_hook (w, &run);
- rif->update_window_end_hook (w, 0, 0);
+ FRAME_RIF (f)->update_window_begin_hook (w);
+ FRAME_RIF (f)->clear_window_mouse_face (w);
+ FRAME_RIF (f)->scroll_run_hook (w, &run);
+ FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
update_end (f);
}
/* Window must either use window-based redisplay or be full width. */
if (!FRAME_WINDOW_P (f)
- && (!line_ins_del_ok
+ && (!FRAME_LINE_INS_DEL_OK (f)
|| !WINDOW_FULL_WIDTH_P (w)))
GIVE_UP (4);
&& CHARPOS (start) > BEGV)
/* Old redisplay didn't take scroll margin into account at the bottom,
but then global-hl-line-mode doesn't scroll. KFS 2004-06-14 */
- || w->cursor.y + cursor_height + this_scroll_margin > it.last_visible_y)
+ || (w->cursor.y + (make_cursor_line_fully_visible_p
+ ? cursor_height + this_scroll_margin
+ : 1)) > it.last_visible_y)
{
w->cursor.vpos = -1;
clear_glyph_matrix (w->desired_matrix);
if (FRAME_WINDOW_P (f))
{
- rif->update_window_begin_hook (w);
- rif->clear_window_mouse_face (w);
- rif->scroll_run_hook (w, &run);
- rif->update_window_end_hook (w, 0, 0);
+ FRAME_RIF (f)->update_window_begin_hook (w);
+ FRAME_RIF (f)->clear_window_mouse_face (w);
+ FRAME_RIF (f)->scroll_run_hook (w, &run);
+ FRAME_RIF (f)->update_window_end_hook (w, 0, 0);
}
else
{
{
/* Scroll last_unchanged_at_beg_row to the end of the
window down dvpos lines. */
- set_terminal_window (end);
+ set_terminal_window (f, end);
/* On dumb terminals delete dvpos lines at the end
before inserting dvpos empty lines. */
- if (!scroll_region_ok)
- ins_del_lines (end - dvpos, -dvpos);
+ if (!FRAME_SCROLL_REGION_OK (f))
+ ins_del_lines (f, end - dvpos, -dvpos);
/* Insert dvpos empty lines in front of
last_unchanged_at_beg_row. */
- ins_del_lines (from, dvpos);
+ ins_del_lines (f, from, dvpos);
}
else if (dvpos < 0)
{
/* Scroll up last_unchanged_at_beg_vpos to the end of
the window to last_unchanged_at_beg_vpos - |dvpos|. */
- set_terminal_window (end);
+ set_terminal_window (f, end);
/* Delete dvpos lines in front of
last_unchanged_at_beg_vpos. ins_del_lines will set
the cursor to the given vpos and emit |dvpos| delete
line sequences. */
- ins_del_lines (from + dvpos, dvpos);
+ ins_del_lines (f, from + dvpos, dvpos);
/* On a dumb terminal insert dvpos empty lines at the
end. */
- if (!scroll_region_ok)
- ins_del_lines (end + dvpos, -dvpos);
+ if (!FRAME_SCROLL_REGION_OK (f))
+ ins_del_lines (f, end + dvpos, -dvpos);
}
- set_terminal_window (0);
+ set_terminal_window (f, 0);
}
update_end (f);
row->height = it->max_ascent + it->max_descent;
row->phys_ascent = it->max_phys_ascent;
row->phys_height = it->max_phys_ascent + it->max_phys_descent;
+ row->extra_line_spacing = it->max_extra_line_spacing;
}
/* Compute the width of this line. */
row->pixel_width -= it->truncation_pixel_width;
row->ascent = row->phys_ascent = 0;
row->height = row->phys_height = row->visible_height = 1;
+ row->extra_line_spacing = 0;
}
/* Compute a hash code for this row. */
&& glyph->u.ch == ' '))
&& trailing_whitespace_p (glyph->charpos))
{
- int face_id = lookup_named_face (f, Qtrailing_whitespace, 0);
+ int face_id = lookup_named_face (f, Qtrailing_whitespace, 0, 0);
+ if (face_id < 0)
+ return;
while (glyph >= start
&& BUFFERP (glyph->object)
hscrolled. This may stop at an x-position < IT->first_visible_x
if the first glyph is partially visible or if we hit a line end. */
if (it->current_x < it->first_visible_x)
- move_it_in_display_line_to (it, ZV, it->first_visible_x,
- MOVE_TO_POS | MOVE_TO_X);
+ {
+ move_it_in_display_line_to (it, ZV, it->first_visible_x,
+ MOVE_TO_POS | MOVE_TO_X);
+ }
/* Get the initial row height. This is either the height of the
text hscrolled, if there is any, or zero. */
row->height = it->max_ascent + it->max_descent;
row->phys_ascent = it->max_phys_ascent;
row->phys_height = it->max_phys_ascent + it->max_phys_descent;
+ row->extra_line_spacing = it->max_extra_line_spacing;
/* Loop generating characters. The loop is left with IT on the next
character to display. */
row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
row->phys_height = max (row->phys_height,
it->max_phys_ascent + it->max_phys_descent);
+ row->extra_line_spacing = max (row->extra_line_spacing,
+ it->max_extra_line_spacing);
set_iterator_to_next (it, 1);
continue;
}
row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
row->phys_height = max (row->phys_height,
it->max_phys_ascent + it->max_phys_descent);
+ row->extra_line_spacing = max (row->extra_line_spacing,
+ it->max_extra_line_spacing);
if (it->current_x - it->pixel_width < it->first_visible_x)
row->x = x - it->first_visible_x;
}
row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
row->phys_height = max (row->phys_height,
it->max_phys_ascent + it->max_phys_descent);
+ row->extra_line_spacing = max (row->extra_line_spacing,
+ it->max_extra_line_spacing);
/* End of this display line if row is continued. */
if (row->continued_p || row->ends_at_zv_p)
{
if (!get_next_display_element (it))
{
-#ifdef HAVE_WINDOW_SYSTEM
it->continuation_lines_width = 0;
row->ends_at_zv_p = 1;
row->exact_window_width_line_p = 1;
break;
-#endif /* HAVE_WINDOW_SYSTEM */
}
if (ITERATOR_AT_END_OF_LINE_P (it))
{
if (this - 1 != last)
{
+ int nchars, nbytes;
+
/* Output to end of string or up to '%'. Field width
is length of string. Don't output more than
PRECISION allows us. */
--this;
- prec = chars_in_text (last, this - last);
- if (precision > 0 && prec > precision - n)
- prec = precision - n;
+ prec = c_string_width (last, this - last, precision - n,
+ &nchars, &nbytes);
if (frame_title_ptr)
n += store_frame_title (last, 0, prec);
{
int bytepos = last - lisp_string;
int charpos = string_byte_to_char (elt, bytepos);
+ int endpos = (precision <= 0
+ ? string_byte_to_char (elt,
+ this - lisp_string)
+ : charpos + nchars);
+
n += store_mode_line_string (NULL,
Fsubstring (elt, make_number (charpos),
- make_number (charpos + prec)),
+ make_number (endpos)),
0, 0, 0, Qnil);
}
else
props = mode_line_string_face_prop;
else if (!NILP (mode_line_string_face))
{
- Lisp_Object face = Fplist_get (props, Qface);
+ Lisp_Object face = Fsafe_plist_get (props, Qface);
props = Fcopy_sequence (props);
if (NILP (face))
face = mode_line_string_face;
Lisp_Object face;
if (NILP (props))
props = Ftext_properties_at (make_number (0), lisp_string);
- face = Fplist_get (props, Qface);
+ face = Fsafe_plist_get (props, Qface);
if (NILP (face))
face = mode_line_string_face;
else
{
tenths = remainder / 100;
if (50 <= remainder % 100)
- if (tenths < 9)
- tenths++;
- else
- {
- quotient++;
- if (quotient == 10)
- tenths = -1;
- else
- tenths = 0;
- }
+ {
+ if (tenths < 9)
+ tenths++;
+ else
+ {
+ quotient++;
+ if (quotient == 10)
+ tenths = -1;
+ else
+ tenths = 0;
+ }
+ }
}
else
if (500 <= remainder)
- if (quotient < 999)
- quotient++;
- else
- {
- quotient = 1;
- exponent++;
- tenths = 0;
- }
+ {
+ if (quotient < 999)
+ quotient++;
+ else
+ {
+ quotient = 1;
+ exponent++;
+ tenths = 0;
+ }
+ }
}
/* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */
{
/* No need to mention EOL here--the terminal never needs
to do EOL conversion. */
- p = decode_mode_spec_coding (keyboard_coding.symbol, p, 0);
- p = decode_mode_spec_coding (terminal_coding.symbol, p, 0);
+ p = decode_mode_spec_coding (FRAME_KEYBOARD_CODING (f)->symbol, p, 0);
+ p = decode_mode_spec_coding (FRAME_TERMINAL_CODING (f)->symbol, p, 0);
}
p = decode_mode_spec_coding (b->buffer_file_coding_system,
p, eol_flag);
row->height = it->max_ascent + it->max_descent;
row->phys_ascent = it->max_phys_ascent;
row->phys_height = it->max_phys_ascent + it->max_phys_descent;
+ row->extra_line_spacing = it->max_extra_line_spacing;
/* This condition is for the case that we are called with current_x
past last_visible_x. */
row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent);
row->phys_height = max (row->phys_height,
it->max_phys_ascent + it->max_phys_descent);
+ row->extra_line_spacing = max (row->extra_line_spacing,
+ it->max_extra_line_spacing);
x += glyph->pixel_width;
++i;
}
s->y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
/* Display the internal border below the tool-bar window. */
- if (s->w == XWINDOW (s->f->tool_bar_window))
+ if (WINDOWP (s->f->tool_bar_window)
+ && s->w == XWINDOW (s->f->tool_bar_window))
s->y -= FRAME_INTERNAL_BORDER_WIDTH (s->f);
s->ybase = s->y + row->ascent;
= FONT_INFO_FROM_ID (f, face->font_info_id);
if (font_info)
glyph->font_type
- = rif->encode_char (glyph->u.ch, char2b, font_info, two_byte_p);
+ = FRAME_RIF (f)->encode_char (glyph->u.ch, char2b, font_info, two_byte_p);
}
}
font = face->font;
font_info = FONT_INFO_FROM_ID (f, face->font_info_id);
if (font /* ++KFS: Should this be font_info ? */
- && (pcm = rif->per_char_metric (font, &char2b, glyph->font_type)))
+ && (pcm = FRAME_RIF (f)->per_char_metric (font, &char2b, glyph->font_type)))
{
if (pcm->rbearing > pcm->width)
*right = pcm->rbearing - pcm->width;
struct font_info *font_info
= FONT_INFO_FROM_ID (f, face->font_info_id);
if (font_info)
- rif->encode_char (c, char2b, font_info, 0);
+ FRAME_RIF (f)->encode_char (c, char2b, font_info, 0);
}
}
{
while (s)
{
- if (rif->compute_glyph_string_overhangs)
- rif->compute_glyph_string_overhangs (s);
+ if (FRAME_RIF (s->f)->compute_glyph_string_overhangs)
+ FRAME_RIF (s->f)->compute_glyph_string_overhangs (s);
x -= s->width;
s->x = x;
s = s->prev;
{
while (s)
{
- if (rif->compute_glyph_string_overhangs)
- rif->compute_glyph_string_overhangs (s);
+ if (FRAME_RIF (s->f)->compute_glyph_string_overhangs)
+ FRAME_RIF (s->f)->compute_glyph_string_overhangs (s);
s->x = x;
x += s->width;
s = s->next;
struct glyph_string *h, *t;
/* Compute overhangs for all glyph strings. */
- if (rif->compute_glyph_string_overhangs)
+ if (FRAME_RIF (f)->compute_glyph_string_overhangs)
for (s = head; s; s = s->next)
- rif->compute_glyph_string_overhangs (s);
+ FRAME_RIF (f)->compute_glyph_string_overhangs (s);
/* Prepend glyph strings for glyphs in front of the first glyph
string that are overwritten because of the first glyph
/* Draw all strings. */
for (s = head; s; s = s->next)
- rif->draw_glyph_string (s);
+ FRAME_RIF (f)->draw_glyph_string (s);
if (area == TEXT_AREA
&& !row->full_width_p
return x_reached;
}
+/* Expand row matrix if too narrow. Don't expand if area
+ is not present. */
+
+#define IT_EXPAND_MATRIX_WIDTH(it, area) \
+ { \
+ if (!fonts_changed_p \
+ && (it->glyph_row->glyphs[area] \
+ < it->glyph_row->glyphs[area + 1])) \
+ { \
+ it->w->ncols_scale_factor++; \
+ fonts_changed_p = 1; \
+ } \
+ }
/* Store one glyph for IT->char_to_display in IT->glyph_row.
Called from x_produce_glyphs when IT->glyph_row is non-null. */
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
}
- else if (!fonts_changed_p)
- {
- it->w->ncols_scale_factor++;
- fonts_changed_p = 1;
- }
+ else
+ IT_EXPAND_MATRIX_WIDTH (it, area);
}
/* Store one glyph for the composition IT->cmp_id in IT->glyph_row.
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
}
- else if (!fonts_changed_p)
- {
- it->w->ncols_scale_factor++;
- fonts_changed_p = 1;
- }
+ else
+ IT_EXPAND_MATRIX_WIDTH (it, area);
}
{
struct image *img;
struct face *face;
- int face_ascent, glyph_ascent;
+ int glyph_ascent;
struct glyph_slice slice;
xassert (it->what == IT_IMAGE);
#if 0 /* this breaks image tiling */
/* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */
- face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f);
+ int face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f);
if (face_ascent > it->ascent)
it->ascent = it->phys_ascent = face_ascent;
#endif
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
}
- else if (!fonts_changed_p)
- {
- it->w->ncols_scale_factor++;
- fonts_changed_p = 1;
- }
+ else
+ IT_EXPAND_MATRIX_WIDTH (it, area);
}
}
glyph->font_type = FONT_TYPE_UNKNOWN;
++it->glyph_row->used[area];
}
- else if (!fonts_changed_p)
- {
- it->w->ncols_scale_factor++;
- fonts_changed_p = 1;
- }
+ else
+ IT_EXPAND_MATRIX_WIDTH (it, area);
}
plist = XCDR (it->object);
/* Compute the width of the stretch. */
- if ((prop = Fplist_get (plist, QCwidth), !NILP (prop))
+ if ((prop = Fsafe_plist_get (plist, QCwidth), !NILP (prop))
&& calc_pixel_width_or_height (&tem, it, prop, font, 1, 0))
{
/* Absolute width `:width WIDTH' specified and valid. */
zero_width_ok_p = 1;
width = (int)tem;
}
- else if (prop = Fplist_get (plist, QCrelative_width),
+ else if (prop = Fsafe_plist_get (plist, QCrelative_width),
NUMVAL (prop) > 0)
{
/* Relative width `:relative-width FACTOR' specified and valid.
x_produce_glyphs (&it2);
width = NUMVAL (prop) * it2.pixel_width;
}
- else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
+ else if ((prop = Fsafe_plist_get (plist, QCalign_to), !NILP (prop))
&& calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to))
{
if (it->glyph_row == NULL || !it->glyph_row->mode_line_p)
width = 1;
/* Compute height. */
- if ((prop = Fplist_get (plist, QCheight), !NILP (prop))
+ if ((prop = Fsafe_plist_get (plist, QCheight), !NILP (prop))
&& calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
{
height = (int)tem;
zero_height_ok_p = 1;
}
- else if (prop = Fplist_get (plist, QCrelative_height),
+ else if (prop = Fsafe_plist_get (plist, QCrelative_height),
NUMVAL (prop) > 0)
height = FONT_HEIGHT (font) * NUMVAL (prop);
else
/* Compute percentage of height used for ascent. If
`:ascent ASCENT' is present and valid, use that. Otherwise,
derive the ascent from the font in use. */
- if (prop = Fplist_get (plist, QCascent),
+ if (prop = Fsafe_plist_get (plist, QCascent),
NUMVAL (prop) > 0 && NUMVAL (prop) <= 100)
ascent = height * NUMVAL (prop) / 100.0;
else if (!NILP (prop)
struct face *face;
struct font_info *font_info;
- face_id = lookup_named_face (it->f, face_name, ' ');
+ face_id = lookup_named_face (it->f, face_name, ' ', 0);
if (face_id < 0)
return make_number (-1);
it->nglyphs = 1;
- pcm = rif->per_char_metric (font, &char2b,
- FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
-
- if (it->override_ascent >= 0)
- {
- it->ascent = it->override_ascent;
- it->descent = it->override_descent;
- boff = it->override_boff;
- }
- else
- {
- it->ascent = FONT_BASE (font) + boff;
- it->descent = FONT_DESCENT (font) - boff;
- }
+ pcm = FRAME_RIF (it->f)->per_char_metric
+ (font, &char2b, FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
+
+ if (it->override_ascent >= 0)
+ {
+ it->ascent = it->override_ascent;
+ it->descent = it->override_descent;
+ boff = it->override_boff;
+ }
+ else
+ {
+ it->ascent = FONT_BASE (font) + boff;
+ it->descent = FONT_DESCENT (font) - boff;
+ }
if (pcm)
{
from the charset width; this is what old redisplay code
did. */
- pcm = rif->per_char_metric (font, &char2b,
- FONT_TYPE_FOR_MULTIBYTE (font, it->c));
+ pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+ FONT_TYPE_FOR_MULTIBYTE (font, it->c));
if (font_not_found_p || !pcm)
{
/* Initialize the bounding box. */
if (font_info
- && (pcm = rif->per_char_metric (font, &char2b,
- FONT_TYPE_FOR_MULTIBYTE (font, it->c))))
+ && (pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+ FONT_TYPE_FOR_MULTIBYTE (font, it->c))))
{
width = pcm->width;
ascent = pcm->ascent;
}
if (font_info
- && (pcm = rif->per_char_metric (font, &char2b,
- FONT_TYPE_FOR_MULTIBYTE (font, ch))))
+ && (pcm = FRAME_RIF (it->f)->per_char_metric (font, &char2b,
+ FONT_TYPE_FOR_MULTIBYTE (font, ch))))
{
width = pcm->width;
ascent = pcm->ascent;
it->current_x += it->pixel_width;
if (extra_line_spacing > 0)
- it->descent += extra_line_spacing;
+ {
+ it->descent += extra_line_spacing;
+ if (extra_line_spacing > it->max_extra_line_spacing)
+ it->max_extra_line_spacing = extra_line_spacing;
+ }
it->max_ascent = max (it->max_ascent, it->ascent);
it->max_descent = max (it->max_descent, it->descent);
frame_x = window_box_left (w, updated_area) + output_cursor.x;
frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, output_cursor.y);
- rif->shift_glyphs_for_insert (f, frame_x, frame_y, shifted_region_width,
- line_height, shift_by_width);
+ FRAME_RIF (f)->shift_glyphs_for_insert (f, frame_x, frame_y, shifted_region_width,
+ line_height, shift_by_width);
/* Write the glyphs. */
hpos = start - row->glyphs[updated_area];
if (to_x > from_x && to_y > from_y)
{
BLOCK_INPUT;
- rif->clear_frame_area (f, from_x, from_y,
- to_x - from_x, to_y - from_y);
+ FRAME_RIF (f)->clear_frame_area (f, from_x, from_y,
+ to_x - from_x, to_y - from_y);
UNBLOCK_INPUT;
}
}
if (!cursor_row->enabled_p)
goto mark_cursor_off;
+ /* If line spacing is > 0, old cursor may only be partially visible in
+ window after split-window. So adjust visible height. */
+ cursor_row->visible_height = min (cursor_row->visible_height,
+ window_text_bottom_y (w) - cursor_row->y);
+
/* If row is completely invisible, don't attempt to delete a cursor which
isn't there. This can happen if cursor is at top of a window, and
we switch to a buffer with a header line in that window. */
{
int x, y;
int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
+ int width;
cursor_glyph = get_phys_cursor_glyph (w);
if (cursor_glyph == NULL)
x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
y = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, cursor_row->y));
+ width = min (cursor_glyph->pixel_width,
+ window_box_width (w, TEXT_AREA) - w->phys_cursor.x);
- rif->clear_frame_area (f, x, y,
- cursor_glyph->pixel_width, cursor_row->visible_height);
+ FRAME_RIF (f)->clear_frame_area (f, x, y, width, cursor_row->visible_height);
}
/* Erase the cursor by redrawing the character underneath it. */
w->phys_cursor.vpos = vpos;
}
- rif->draw_window_cursor (w, glyph_row, x, y,
- new_cursor_type, new_cursor_width,
- on, active_cursor);
+ FRAME_RIF (f)->draw_window_cursor (w, glyph_row, x, y,
+ new_cursor_type, new_cursor_width,
+ on, active_cursor);
}
/* Change the mouse cursor. */
if (draw == DRAW_NORMAL_TEXT)
- rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
+ FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
else if (draw == DRAW_MOUSE_FACE)
- rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
+ FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
else
- rif->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
+ FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
}
/* EXPORT:
int past_end = 0;
first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
+ if (charpos < MATRIX_ROW_START_CHARPOS (first))
+ {
+ *x = first->x;
+ *y = first->y;
+ *hpos = 0;
+ *vpos = MATRIX_ROW_VPOS (first, w->current_matrix);
+ return 1;
+ }
+
row = row_containing_pos (w, charpos, first, NULL, 0);
if (row == NULL)
{
- if (charpos < MATRIX_ROW_START_CHARPOS (first))
- {
- *x = *y = *hpos = *vpos = 0;
- return 1;
- }
- else
- {
- row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
- past_end = 1;
- }
+ row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos));
+ past_end = 1;
}
*x = row->x;
return inside;
}
}
- /* If we don't understand the format, pretend we're not in the hot-spot. */
return 0;
}
}
if (cursor != No_Cursor)
- rif->define_frame_cursor (f, cursor);
+ FRAME_RIF (f)->define_frame_cursor (f, cursor);
}
/* Take proper action when mouse has moved to the mode or header line
if (IMAGEP (object))
{
Lisp_Object image_map, hotspot;
- if ((image_map = Fplist_get (XCDR (object), QCmap),
+ if ((image_map = Fsafe_plist_get (XCDR (object), QCmap),
!NILP (image_map))
&& (hotspot = find_hot_spot (image_map, dx, dy),
CONSP (hotspot))
/* Could check AREA_ID to see if we enter/leave this hot-spot.
If so, we could look for mouse-enter, mouse-leave
properties in PLIST (and do something...). */
- if ((plist = XCDR (hotspot), CONSP (plist)))
+ hotspot = XCDR (hotspot);
+ if (CONSP (hotspot)
+ && (plist = XCAR (hotspot), CONSP (plist)))
{
- pointer = Fplist_get (plist, Qpointer);
+ pointer = Fsafe_plist_get (plist, Qpointer);
if (NILP (pointer))
pointer = Qhand;
- help = Fplist_get (plist, Qhelp_echo);
+ help = Fsafe_plist_get (plist, Qhelp_echo);
if (!NILP (help))
{
help_echo_string = help;
}
}
if (NILP (pointer))
- pointer = Fplist_get (XCDR (object), QCpointer);
+ pointer = Fsafe_plist_get (XCDR (object), QCpointer);
}
}
/* If we're on a string with `help-echo' text property, arrange
for the help to be displayed. This is done by setting the
global variable help_echo_string to the help string. */
- help = Fget_text_property (pos, Qhelp_echo, string);
- if (!NILP (help))
+ if (NILP (help))
{
- help_echo_string = help;
- XSETWINDOW (help_echo_window, w);
- help_echo_object = string;
- help_echo_pos = charpos;
+ help = Fget_text_property (pos, Qhelp_echo, string);
+ if (!NILP (help))
+ {
+ help_echo_string = help;
+ XSETWINDOW (help_echo_window, w);
+ help_echo_object = string;
+ help_echo_pos = charpos;
+ }
}
if (NILP (pointer))
/* Which window is that in? */
window = window_from_coordinates (f, x, y, &part, 0, 0, 1);
- /* If we were displaying active text in another window, clear that. */
- if (! EQ (window, dpyinfo->mouse_face_window))
+ /* If we were displaying active text in another window, clear that.
+ Also clear if we move out of text area in same window. */
+ if (! EQ (window, dpyinfo->mouse_face_window)
+ || (part != ON_TEXT && !NILP (dpyinfo->mouse_face_window)))
clear_mouse_face (dpyinfo);
/* Not on a window -> return. */
if (img != NULL && IMAGEP (img->spec))
{
Lisp_Object image_map, hotspot;
- if ((image_map = Fplist_get (XCDR (img->spec), QCmap),
+ if ((image_map = Fsafe_plist_get (XCDR (img->spec), QCmap),
!NILP (image_map))
&& (hotspot = find_hot_spot (image_map,
glyph->slice.x + dx,
/* Could check AREA_ID to see if we enter/leave this hot-spot.
If so, we could look for mouse-enter, mouse-leave
properties in PLIST (and do something...). */
- if ((plist = XCDR (hotspot), CONSP (plist)))
+ hotspot = XCDR (hotspot);
+ if (CONSP (hotspot)
+ && (plist = XCAR (hotspot), CONSP (plist)))
{
- pointer = Fplist_get (plist, Qpointer);
+ pointer = Fsafe_plist_get (plist, Qpointer);
if (NILP (pointer))
pointer = Qhand;
- help_echo_string = Fplist_get (plist, Qhelp_echo);
+ help_echo_string = Fsafe_plist_get (plist, Qhelp_echo);
if (!NILP (help_echo_string))
{
help_echo_window = window;
}
}
if (NILP (pointer))
- pointer = Fplist_get (XCDR (img->spec), QCpointer);
+ pointer = Fsafe_plist_get (XCDR (img->spec), QCpointer);
}
}
I assume the effect is the same -- and this is portable. */
return x_intersect_rectangles (&cr, r, &result);
}
- else
- return 0;
+ /* If we don't understand the format, pretend we're not in the hot-spot. */
+ return 0;
}
x_draw_vertical_border (w)
struct window *w;
{
+ struct frame *f = XFRAME (WINDOW_FRAME (w));
+
/* We could do better, if we knew what type of scroll-bar the adjacent
windows (on either side) have... But we don't :-(
However, I think this works ok. ++KFS 2003-04-25 */
window_box_edges (w, -1, &x0, &y0, &x1, &y1);
y1 -= 1;
- rif->draw_vertical_window_border (w, x1, y0, y1);
+ FRAME_RIF (f)->draw_vertical_window_border (w, x1, y0, y1);
}
else if (!WINDOW_LEFTMOST_P (w)
&& !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
window_box_edges (w, -1, &x0, &y0, &x1, &y1);
y1 -= 1;
- rif->draw_vertical_window_border (w, x0, y0, y1);
+ FRAME_RIF (f)->draw_vertical_window_border (w, x0, y0, y1);
}
}
staticpro (&Qfontification_functions);
Qtrailing_whitespace = intern ("trailing-whitespace");
staticpro (&Qtrailing_whitespace);
+ Qescape_glyph = intern ("escape-glyph");
+ staticpro (&Qescape_glyph);
Qimage = intern ("image");
staticpro (&Qimage);
QCmap = intern (":map");
doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over them. */);
auto_raise_tool_bar_buttons_p = 1;
+ DEFVAR_BOOL ("make-cursor-line-fully-visible", &make_cursor_line_fully_visible_p,
+ doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible. */);
+ make_cursor_line_fully_visible_p = 1;
+
DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin,
doc: /* *Margin around tool-bar buttons in pixels.
If an integer, use that for both horizontal and vertical margins.