* lisp.h (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
(last_glyphless_glyph_merged_face_id): Remove declarations. * dispextern.h (merge_glyphless_glyph_face): Add prototype. * xdisp.c (last_glyphless_glyph_frame, last_glyphless_glyph_face_id) (last_glyphless_glyph_merged_face_id): Now static. (merge_escape_glyph_face): New function, refactored from... (get_next_display_element): ...here. (merge_glyphless_glyph_face): New function, refactored from... (produce_glyphless_glyph): ...here... * term.c (produce_glyphless_glyph): ...and here.
This commit is contained in:
parent
86cf732991
commit
77394d40d9
5 changed files with 72 additions and 81 deletions
|
@ -1,3 +1,16 @@
|
|||
2013-09-06 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* lisp.h (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
|
||||
(last_glyphless_glyph_merged_face_id): Remove declarations.
|
||||
* dispextern.h (merge_glyphless_glyph_face): Add prototype.
|
||||
* xdisp.c (last_glyphless_glyph_frame, last_glyphless_glyph_face_id)
|
||||
(last_glyphless_glyph_merged_face_id): Now static.
|
||||
(merge_escape_glyph_face): New function, refactored from...
|
||||
(get_next_display_element): ...here.
|
||||
(merge_glyphless_glyph_face): New function, refactored from...
|
||||
(produce_glyphless_glyph): ...here...
|
||||
* term.c (produce_glyphless_glyph): ...and here.
|
||||
|
||||
2013-09-06 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||
|
||||
* eval.c (eval_sub): Only call Ffunction if necessary.
|
||||
|
|
|
@ -3208,6 +3208,7 @@ extern ptrdiff_t compute_display_string_pos (struct text_pos *,
|
|||
extern ptrdiff_t compute_display_string_end (ptrdiff_t,
|
||||
struct bidi_string_data *);
|
||||
extern void produce_stretch_glyph (struct it *);
|
||||
extern int merge_glyphless_glyph_face (struct it *);
|
||||
|
||||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
|
||||
|
|
|
@ -3359,9 +3359,6 @@ extern Lisp_Object Qglyphless_char;
|
|||
extern Lisp_Object QCdata, QCfile;
|
||||
extern Lisp_Object QCmap;
|
||||
extern Lisp_Object Qrisky_local_variable;
|
||||
extern struct frame *last_glyphless_glyph_frame;
|
||||
extern int last_glyphless_glyph_face_id;
|
||||
extern int last_glyphless_glyph_merged_face_id;
|
||||
extern int noninteractive_need_newline;
|
||||
extern Lisp_Object echo_area_buffer[2];
|
||||
extern void add_to_log (const char *, Lisp_Object, Lisp_Object);
|
||||
|
|
19
src/term.c
19
src/term.c
|
@ -1800,27 +1800,10 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str)
|
|||
static void
|
||||
produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
|
||||
{
|
||||
int face_id;
|
||||
int len;
|
||||
int len, face_id = merge_glyphless_glyph_face (it);
|
||||
char buf[sizeof "\\x" + max (6, (sizeof it->c * CHAR_BIT + 3) / 4)];
|
||||
char const *str = " ";
|
||||
|
||||
/* Get a face ID for the glyph by utilizing a cache (the same way as
|
||||
done for `escape-glyph' in get_next_display_element). */
|
||||
if (it->f == last_glyphless_glyph_frame
|
||||
&& it->face_id == last_glyphless_glyph_face_id)
|
||||
{
|
||||
face_id = last_glyphless_glyph_merged_face_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Merge the `glyphless-char' face into the current face. */
|
||||
face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
|
||||
last_glyphless_glyph_frame = it->f;
|
||||
last_glyphless_glyph_face_id = it->face_id;
|
||||
last_glyphless_glyph_merged_face_id = face_id;
|
||||
}
|
||||
|
||||
if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
|
||||
{
|
||||
/* As there's no way to produce a thin space, we produce a space
|
||||
|
|
117
src/xdisp.c
117
src/xdisp.c
|
@ -6666,17 +6666,59 @@ lookup_glyphless_char_display (int c, struct it *it)
|
|||
return glyphless_method;
|
||||
}
|
||||
|
||||
/* Load IT's display element fields with information about the next
|
||||
display element from the current position of IT. Value is zero if
|
||||
end of buffer (or C string) is reached. */
|
||||
/* Merge escape glyph face and cache the result. */
|
||||
|
||||
static struct frame *last_escape_glyph_frame = NULL;
|
||||
static int last_escape_glyph_face_id = (1 << FACE_ID_BITS);
|
||||
static int last_escape_glyph_merged_face_id = 0;
|
||||
|
||||
struct frame *last_glyphless_glyph_frame = NULL;
|
||||
int last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
|
||||
int last_glyphless_glyph_merged_face_id = 0;
|
||||
static int
|
||||
merge_escape_glyph_face (struct it *it)
|
||||
{
|
||||
int face_id;
|
||||
|
||||
if (it->f == last_escape_glyph_frame
|
||||
&& it->face_id == last_escape_glyph_face_id)
|
||||
face_id = last_escape_glyph_merged_face_id;
|
||||
else
|
||||
{
|
||||
/* Merge the `escape-glyph' face into the current face. */
|
||||
face_id = merge_faces (it->f, Qescape_glyph, 0, it->face_id);
|
||||
last_escape_glyph_frame = it->f;
|
||||
last_escape_glyph_face_id = it->face_id;
|
||||
last_escape_glyph_merged_face_id = face_id;
|
||||
}
|
||||
return face_id;
|
||||
}
|
||||
|
||||
/* Likewise for glyphless glyph face. */
|
||||
|
||||
static struct frame *last_glyphless_glyph_frame = NULL;
|
||||
static int last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
|
||||
static int last_glyphless_glyph_merged_face_id = 0;
|
||||
|
||||
int
|
||||
merge_glyphless_glyph_face (struct it *it)
|
||||
{
|
||||
int face_id;
|
||||
|
||||
if (it->f == last_glyphless_glyph_frame
|
||||
&& it->face_id == last_glyphless_glyph_face_id)
|
||||
face_id = last_glyphless_glyph_merged_face_id;
|
||||
else
|
||||
{
|
||||
/* Merge the `glyphless-char' face into the current face. */
|
||||
face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
|
||||
last_glyphless_glyph_frame = it->f;
|
||||
last_glyphless_glyph_face_id = it->face_id;
|
||||
last_glyphless_glyph_merged_face_id = face_id;
|
||||
}
|
||||
return face_id;
|
||||
}
|
||||
|
||||
/* Load IT's display element fields with information about the next
|
||||
display element from the current position of IT. Value is zero if
|
||||
end of buffer (or C string) is reached. */
|
||||
|
||||
static int
|
||||
get_next_display_element (struct it *it)
|
||||
|
@ -6824,24 +6866,10 @@ get_next_display_element (struct it *it)
|
|||
g = GLYPH_CODE_CHAR (gc);
|
||||
lface_id = GLYPH_CODE_FACE (gc);
|
||||
}
|
||||
if (lface_id)
|
||||
{
|
||||
face_id = merge_faces (it->f, Qt, lface_id, it->face_id);
|
||||
}
|
||||
else if (it->f == last_escape_glyph_frame
|
||||
&& it->face_id == last_escape_glyph_face_id)
|
||||
{
|
||||
face_id = last_escape_glyph_merged_face_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Merge the escape-glyph face into the current face. */
|
||||
face_id = merge_faces (it->f, Qescape_glyph, 0,
|
||||
it->face_id);
|
||||
last_escape_glyph_frame = it->f;
|
||||
last_escape_glyph_face_id = it->face_id;
|
||||
last_escape_glyph_merged_face_id = face_id;
|
||||
}
|
||||
|
||||
face_id = (lface_id
|
||||
? merge_faces (it->f, Qt, lface_id, it->face_id)
|
||||
: merge_escape_glyph_face (it));
|
||||
|
||||
XSETINT (it->ctl_chars[0], g);
|
||||
XSETINT (it->ctl_chars[1], c ^ 0100);
|
||||
|
@ -6873,27 +6901,10 @@ get_next_display_element (struct it *it)
|
|||
escape_glyph = GLYPH_CODE_CHAR (gc);
|
||||
lface_id = GLYPH_CODE_FACE (gc);
|
||||
}
|
||||
if (lface_id)
|
||||
{
|
||||
/* The display table specified a face.
|
||||
Merge it into face_id and also into escape_glyph. */
|
||||
face_id = merge_faces (it->f, Qt, lface_id,
|
||||
it->face_id);
|
||||
}
|
||||
else if (it->f == last_escape_glyph_frame
|
||||
&& it->face_id == last_escape_glyph_face_id)
|
||||
{
|
||||
face_id = last_escape_glyph_merged_face_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Merge the escape-glyph face into the current face. */
|
||||
face_id = merge_faces (it->f, Qescape_glyph, 0,
|
||||
it->face_id);
|
||||
last_escape_glyph_frame = it->f;
|
||||
last_escape_glyph_face_id = it->face_id;
|
||||
last_escape_glyph_merged_face_id = face_id;
|
||||
}
|
||||
|
||||
face_id = (lface_id
|
||||
? merge_faces (it->f, Qt, lface_id, it->face_id)
|
||||
: merge_escape_glyph_face (it));
|
||||
|
||||
/* Draw non-ASCII hyphen with just highlighting: */
|
||||
|
||||
|
@ -24895,21 +24906,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
|
|||
base_height = it->ascent + it->descent;
|
||||
base_width = font->average_width;
|
||||
|
||||
/* Get a face ID for the glyph by utilizing a cache (the same way as
|
||||
done for `escape-glyph' in get_next_display_element). */
|
||||
if (it->f == last_glyphless_glyph_frame
|
||||
&& it->face_id == last_glyphless_glyph_face_id)
|
||||
{
|
||||
face_id = last_glyphless_glyph_merged_face_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Merge the `glyphless-char' face into the current face. */
|
||||
face_id = merge_faces (it->f, Qglyphless_char, 0, it->face_id);
|
||||
last_glyphless_glyph_frame = it->f;
|
||||
last_glyphless_glyph_face_id = it->face_id;
|
||||
last_glyphless_glyph_merged_face_id = face_id;
|
||||
}
|
||||
face_id = merge_glyphless_glyph_face (it);
|
||||
|
||||
if (it->glyphless_method == GLYPHLESS_DISPLAY_THIN_SPACE)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue