From 3434fe8a236bb8fcb098c713b6383810c16a721d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 8 Jul 2012 19:38:43 +0300 Subject: [PATCH] Cleanup changes following fix for bug #11832. src/ xdisp.c (display_line): Add commentary about displaying truncation glyphs on GUI frames. (produce_special_glyphs): Move here from term.c. src/term.c (produce_special_glyphs): Move to xdisp.c. src/dispextern.h (produce_special_glyphs): Move prototype to xdisp.c section. --- src/ChangeLog | 8 ++++++ src/dispextern.h | 3 +-- src/term.c | 61 -------------------------------------------- src/xdisp.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 63 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2fc91007719..98a4f978830 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,14 @@ * xdisp.c (fill_glyphless_glyph_string): If the face of the glyph has no font, use the frame's font. (Bug#11813) + (display_line): Add commentary about displaying truncation glyphs + on GUI frames. + (produce_special_glyphs): Move here from term.c. + + * term.c (produce_special_glyphs): Move to xdisp.c. + + * dispextern.h (produce_special_glyphs): Move prototype to xdisp.c + section. 2012-07-07 Andreas Schwab diff --git a/src/dispextern.h b/src/dispextern.h index 7d9f913e4f1..b08d6107b80 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3065,7 +3065,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 void produce_special_glyphs (struct it *, enum display_element_type); #ifdef HAVE_WINDOW_SYSTEM @@ -3353,7 +3353,6 @@ extern int string_cost (const char *); extern int per_line_cost (const char *); extern void calculate_costs (struct frame *); extern void produce_glyphs (struct it *); -extern void produce_special_glyphs (struct it *, enum display_element_type); extern int tty_capable_p (struct tty_display_info *, unsigned, unsigned long, unsigned long); extern void set_tty_color_mode (struct tty_display_info *, struct frame *); extern struct terminal *get_named_tty (const char *); diff --git a/src/term.c b/src/term.c index 900818559cd..4d73f896d21 100644 --- a/src/term.c +++ b/src/term.c @@ -1885,67 +1885,6 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) append_glyphless_glyph (it, face_id, str); } - -/* Get information about special display element WHAT in an - environment described by IT. WHAT is one of IT_TRUNCATION or - IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a - non-null glyph_row member. This function ensures that fields like - face_id, c, len of IT are left untouched. */ - -void -produce_special_glyphs (struct it *it, enum display_element_type what) -{ - struct it temp_it; - Lisp_Object gc; - GLYPH glyph; - - temp_it = *it; - temp_it.dp = NULL; - temp_it.what = IT_CHARACTER; - temp_it.len = 1; - temp_it.object = make_number (0); - memset (&temp_it.current, 0, sizeof temp_it.current); - - if (what == IT_CONTINUATION) - { - /* Continuation glyph. For R2L lines, we mirror it by hand. */ - if (it->bidi_it.paragraph_dir == R2L) - SET_GLYPH_FROM_CHAR (glyph, '/'); - else - SET_GLYPH_FROM_CHAR (glyph, '\\'); - if (it->dp - && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc))) - { - /* FIXME: Should we mirror GC for R2L lines? */ - SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); - spec_glyph_lookup_face (XWINDOW (it->window), &glyph); - } - } - else if (what == IT_TRUNCATION) - { - /* Truncation glyph. */ - SET_GLYPH_FROM_CHAR (glyph, '$'); - if (it->dp - && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc))) - { - /* FIXME: Should we mirror GC for R2L lines? */ - SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); - spec_glyph_lookup_face (XWINDOW (it->window), &glyph); - } - } - else - abort (); - - temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph); - temp_it.face_id = GLYPH_FACE (glyph); - temp_it.len = CHAR_BYTES (temp_it.c); - - PRODUCE_GLYPHS (&temp_it); - it->pixel_width = temp_it.pixel_width; - it->nglyphs = temp_it.pixel_width; -} - - /*********************************************************************** Faces diff --git a/src/xdisp.c b/src/xdisp.c index 3a485f6a5a9..9018dce37fa 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19773,6 +19773,13 @@ display_line (struct it *it) #ifdef HAVE_WINDOW_SYSTEM else { + /* On a GUI frame, when the right fringe (left + fringe for R2L rows) is turned off, we produce + truncation glyphs preceded by a stretch glyph + whose width is computed such that the truncation + glyphs are aligned at the window margin, even + when very different fonts are used in different + glyph rows. */ int stretch_width = it->last_visible_x - it->current_x; row->used[TEXT_AREA] = i; @@ -24196,6 +24203,65 @@ produce_stretch_glyph (struct it *it) it->nglyphs = width; } +/* Get information about special display element WHAT in an + environment described by IT. WHAT is one of IT_TRUNCATION or + IT_CONTINUATION. Maybe produce glyphs for WHAT if IT has a + non-null glyph_row member. This function ensures that fields like + face_id, c, len of IT are left untouched. */ + +void +produce_special_glyphs (struct it *it, enum display_element_type what) +{ + struct it temp_it; + Lisp_Object gc; + GLYPH glyph; + + temp_it = *it; + temp_it.dp = NULL; + temp_it.what = IT_CHARACTER; + temp_it.len = 1; + temp_it.object = make_number (0); + memset (&temp_it.current, 0, sizeof temp_it.current); + + if (what == IT_CONTINUATION) + { + /* Continuation glyph. For R2L lines, we mirror it by hand. */ + if (it->bidi_it.paragraph_dir == R2L) + SET_GLYPH_FROM_CHAR (glyph, '/'); + else + SET_GLYPH_FROM_CHAR (glyph, '\\'); + if (it->dp + && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc))) + { + /* FIXME: Should we mirror GC for R2L lines? */ + SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); + spec_glyph_lookup_face (XWINDOW (it->window), &glyph); + } + } + else if (what == IT_TRUNCATION) + { + /* Truncation glyph. */ + SET_GLYPH_FROM_CHAR (glyph, '$'); + if (it->dp + && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc))) + { + /* FIXME: Should we mirror GC for R2L lines? */ + SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); + spec_glyph_lookup_face (XWINDOW (it->window), &glyph); + } + } + else + abort (); + + temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph); + temp_it.face_id = GLYPH_FACE (glyph); + temp_it.len = CHAR_BYTES (temp_it.c); + + PRODUCE_GLYPHS (&temp_it); + it->pixel_width = temp_it.pixel_width; + it->nglyphs = temp_it.pixel_width; +} + #ifdef HAVE_WINDOW_SYSTEM /* Calculate line-height and line-spacing properties. -- 2.39.2