static int display_echo_area_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
static int resize_mini_window_1 P_ ((EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT));
static Lisp_Object unwind_redisplay P_ ((Lisp_Object));
-static int string_char_and_length P_ ((const unsigned char *, int, int *));
+static int string_char_and_length P_ ((const unsigned char *, int *));
static struct text_pos display_prop_end P_ ((struct it *, Lisp_Object,
struct text_pos));
static int compute_window_start_on_continuation_line P_ ((struct window *));
character. */
static INLINE int
-string_char_and_length (str, maxlen, len)
+string_char_and_length (str, len)
const unsigned char *str;
- int maxlen, *len;
+ int *len;
{
int c;
- c = STRING_CHAR_AND_LENGTH (str, maxlen, *len);
+ c = STRING_CHAR_AND_LENGTH (str, *len);
if (!CHAR_VALID_P (c, 1))
/* We may not change the length here because other places in Emacs
don't use this function, i.e. they silently accept invalid
while (nchars--)
{
- string_char_and_length (p, rest, &len);
+ string_char_and_length (p, &len);
p += len, rest -= len;
xassert (rest >= 0);
CHARPOS (pos) += 1;
SET_TEXT_POS (pos, 0, 0);
while (charpos--)
{
- string_char_and_length (s, rest, &len);
+ string_char_and_length (s, &len);
s += len, rest -= len;
xassert (rest >= 0);
CHARPOS (pos) += 1;
for (nchars = 0; rest > 0; ++nchars)
{
- string_char_and_length (p, rest, &len);
+ string_char_and_length (p, &len);
rest -= len, p += len;
}
}
int c, len;
struct face *face = FACE_FROM_ID (it->f, face_id);
- c = string_char_and_length (p, rest, &len);
+ c = string_char_and_length (p, &len);
face_id = FACE_FOR_CHAR (it->f, face, c, CHARPOS (pos), it->string);
}
}
pos_byte = IT_STRING_BYTEPOS (*it);
string = it->string;
s = SDATA (string) + pos_byte;
- it->c = STRING_CHAR (s, 0);
+ it->c = STRING_CHAR (s);
}
else
{
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. */
+ IT->saved_face_id holds the face id before the display vector--it
+ is restored into IT->face_id in set_iterator_to_next. */
static int
next_element_from_display_vector (it)
int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
const unsigned char *s = (SDATA (it->string)
+ IT_STRING_BYTEPOS (*it));
- it->c = string_char_and_length (s, remaining, &it->len);
+ it->c = string_char_and_length (s, &it->len);
}
else
{
int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it);
const unsigned char *s = (SDATA (it->string)
+ IT_STRING_BYTEPOS (*it));
- it->c = string_char_and_length (s, maxlen, &it->len);
+ it->c = string_char_and_length (s, &it->len);
}
else
{
performance problem because there is no noticeable performance
difference between Emacs running in unibyte or multibyte mode. */
int maxlen = strlen (it->s) - IT_BYTEPOS (*it);
- it->c = string_char_and_length (it->s + IT_BYTEPOS (*it),
- maxlen, &it->len);
+ it->c = string_char_and_length (it->s + IT_BYTEPOS (*it), &it->len);
}
else
it->c = it->s[IT_BYTEPOS (*it)], it->len = 1;
/* Set up IT to return characters from an ellipsis, if appropriate.
The definition of the ellipsis glyphs may come from a display table
- entry. This function Fills IT with the first glyph from the
+ entry. This function fills IT with the first glyph from the
ellipsis if an ellipsis is to be displayed. */
static int
/* Get the next character, maybe multibyte. */
p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
if (it->multibyte_p && !ASCII_BYTE_P (*p))
- it->c = STRING_CHAR_AND_LENGTH (p, 0, it->len);
+ it->c = STRING_CHAR_AND_LENGTH (p, it->len);
else
it->c = *p, it->len = 1;
for the *Message* buffer. */
for (i = 0; i < nbytes; i += char_bytes)
{
- c = string_char_and_length (m + i, nbytes - i, &char_bytes);
+ c = string_char_and_length (m + i, &char_bytes);
work[0] = (ASCII_CHAR_P (c)
? c
: multibyte_char_to_unibyte (c, Qnil));
/* Convert a multibyte string to single-byte. */
for (i = 0; i < nbytes; i += n)
{
- c = string_char_and_length (s + i, nbytes - i, &n);
+ c = string_char_and_length (s + i, &n);
work[0] = (ASCII_CHAR_P (c)
? c
: multibyte_char_to_unibyte (c, Qnil));
/* Get the next character. */
if (multibyte_p)
- it.c = string_char_and_length (p, arrow_len, &it.len);
+ it.c = string_char_and_length (p, &it.len);
else
it.c = *p, it.len = 1;
p += it.len;
\f
/* Push the display property PROP so that it will be rendered at the
- current position in IT. */
+ current position in IT. Return 1 if PROP was successfully pushed,
+ 0 otherwise. */
-static void
+static int
push_display_prop (struct it *it, Lisp_Object prop)
{
push_it (it);
- /* Never display a cursor on the prefix. */
- it->avoid_cursor_p = 1;
-
if (STRINGP (prop))
{
if (SCHARS (prop) == 0)
{
pop_it (it);
- return;
+ return 0;
}
it->string = prop;
else
{
pop_it (it); /* bogus display property, give up */
- return;
+ return 0;
}
+
+ return 1;
}
/* Return the character-property PROP at the current position in IT. */
if (NILP (prefix))
prefix = Vline_prefix;
}
- if (! NILP (prefix))
+ if (! NILP (prefix) && push_display_prop (it, prefix))
{
- push_display_prop (it, prefix);
/* If the prefix is wider than the window, and we try to wrap
it, it would acquire its own wrap prefix, and so on till the
iterator stack overflows. So, don't wrap the prefix. */
it->line_wrap = TRUNCATE;
+ it->avoid_cursor_p = 1;
}
}
readable" representation of the nonnegative integer D to BUF using
a minimal field width WIDTH. D should be smaller than 999.5e24. */
-static const const char power_letter[] =
+static const char power_letter[] =
{
0, /* not used */
'k', /* kilo */
{
int maxlen = ((IT_BYTEPOS (*it) >= GPT ? ZV : GPT)
- IT_BYTEPOS (*it));
- it2.c = STRING_CHAR_AND_LENGTH (p, maxlen, it2.len);
+ it2.c = STRING_CHAR_AND_LENGTH (p, it2.len);
}
else
it2.c = *p, it2.len = 1;
&char2b, it->multibyte_p, 0);
font = face->font;
- /* When no suitable font found, use the default font. */
font_not_found_p = font == NULL;
if (font_not_found_p)
{
- font = FRAME_FONT (it->f);
- boff = FRAME_BASELINE_OFFSET (it->f);
+ /* When no suitable font found, display an empty box based
+ on the metrics of the font of the default face (or what
+ remapped). */
+ struct face *no_font_face
+ = FACE_FROM_ID (it->f,
+ NILP (Vface_remapping_alist) ? DEFAULT_FACE_ID
+ : lookup_basic_face (it->f, DEFAULT_FACE_ID));
+ font = no_font_face->font;
+ boff = font->baseline_offset;
}
else
{
at least one column. */
char_width = 1;
it->glyph_not_available_p = 1;
- it->pixel_width = FRAME_COLUMN_WIDTH (it->f) * char_width;
+ it->pixel_width = font->space_width * char_width;
it->phys_ascent = FONT_BASE (font) + boff;
it->phys_descent = FONT_DESCENT (font) - boff;
}