From b630991b73713c76c45603ebdb61623953e334c1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Jan 2013 15:37:36 +0200 Subject: Improve display of glyph matrix by dump-glyph-matrix. src/xdisp.c (dump_glyph): Align glyph data better. Use "pD" instead of a non-portable "t" to print ptrdiff_t values. Allow up to 9 digits for buffer positions, before misalignment starts. Display "0" for integer "object" field. (dump_glyph_row): Adapt the header line to changes in dump_glyph. Display the newline glyph more unambiguously. --- src/ChangeLog | 9 +++++++++ src/xdisp.c | 65 +++++++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9e315700e8a..919e9e7de43 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2013-01-05 Eli Zaretskii + + * xdisp.c (dump_glyph): Align glyph data better. Use "pD" instead + of a non-portable "t" to print ptrdiff_t values. Allow up to 9 + digits for buffer positions, before misalignment starts. Display + "0" for integer "object" field. + (dump_glyph_row): Adapt the header line to changes in dump_glyph. + Display the newline glyph more unambiguously. + 2013-01-04 YAMAMOTO Mitsuharu * nsterm.m (ns_draw_underwave): diff --git a/src/xdisp.c b/src/xdisp.c index 55469269900..9fd4f637b64 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -17978,18 +17978,23 @@ dump_glyph_matrix (struct glyph_matrix *matrix, int glyphs) void dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) { - if (glyph->type == CHAR_GLYPH) + if (glyph->type == CHAR_GLYPH + || glyph->type == GLYPHLESS_GLYPH) { fprintf (stderr, - " %5td %4c %6"pI"d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", + " %5"pD"d %c %9"pI"d %c %3d 0x%06x %c %4d %1.1d%1.1d\n", glyph - row->glyphs[TEXT_AREA], - 'C', + (glyph->type == CHAR_GLYPH + ? 'C' + : 'G'), glyph->charpos, (BUFFERP (glyph->object) ? 'B' : (STRINGP (glyph->object) ? 'S' - : '-')), + : (INTEGERP (glyph->object) + ? '0' + : '-'))), glyph->pixel_width, glyph->u.ch, (glyph->u.ch < 0x80 && glyph->u.ch >= ' ' @@ -18002,7 +18007,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) else if (glyph->type == STRETCH_GLYPH) { fprintf (stderr, - " %5td %4c %6"pI"d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", + " %5"pD"d %c %9"pI"d %c %3d 0x%06x %c %4d %1.1d%1.1d\n", glyph - row->glyphs[TEXT_AREA], 'S', glyph->charpos, @@ -18010,10 +18015,12 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) ? 'B' : (STRINGP (glyph->object) ? 'S' - : '-')), + : (INTEGERP (glyph->object) + ? '0' + : '-'))), glyph->pixel_width, 0, - '.', + ' ', glyph->face_id, glyph->left_box_line_p, glyph->right_box_line_p); @@ -18021,7 +18028,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) else if (glyph->type == IMAGE_GLYPH) { fprintf (stderr, - " %5td %4c %6"pI"d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", + " %5"pD"d %c %9"pI"d %c %3d 0x%06x %c %4d %1.1d%1.1d\n", glyph - row->glyphs[TEXT_AREA], 'I', glyph->charpos, @@ -18029,7 +18036,9 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) ? 'B' : (STRINGP (glyph->object) ? 'S' - : '-')), + : (INTEGERP (glyph->object) + ? '0' + : '-'))), glyph->pixel_width, glyph->u.img_id, '.', @@ -18040,7 +18049,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) else if (glyph->type == COMPOSITE_GLYPH) { fprintf (stderr, - " %5td %4c %6"pI"d %c %3d 0x%05x", + " %5"pD"d %c %9"pI"d %c %3d 0x%06x", glyph - row->glyphs[TEXT_AREA], '+', glyph->charpos, @@ -18048,7 +18057,9 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) ? 'B' : (STRINGP (glyph->object) ? 'S' - : '-')), + : (INTEGERP (glyph->object) + ? '0' + : '-'))), glyph->pixel_width, glyph->u.cmp.id); if (glyph->u.cmp.automatic) @@ -18073,10 +18084,10 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs) { if (glyphs != 1) { - fprintf (stderr, "Row Start End Used oE><\\CTZFesm X Y W H V A P\n"); - fprintf (stderr, "======================================================================\n"); + fprintf (stderr, "Row Start End Used oE><\\CTZFesm X Y W H V A P\n"); + fprintf (stderr, "==============================================================================\n"); - fprintf (stderr, "%3d %5"pI"d %5"pI"d %4d %1.1d%1.1d%1.1d%1.1d\ + fprintf (stderr, "%3d %9"pI"d %9"pI"d %4d %1.1d%1.1d%1.1d%1.1d\ %1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n", vpos, MATRIX_ROW_START_CHARPOS (row), @@ -18101,13 +18112,14 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs) row->visible_height, row->ascent, row->phys_ascent); - fprintf (stderr, "%9"pD"d %5"pD"d\t%5d\n", row->start.overlay_string_index, + /* The next 3 lines should align to "Start" in the header. */ + fprintf (stderr, " %9"pD"d %9"pD"d\t%5d\n", row->start.overlay_string_index, row->end.overlay_string_index, row->continuation_lines_width); - fprintf (stderr, "%9"pI"d %5"pI"d\n", + fprintf (stderr, " %9"pI"d %9"pI"d\n", CHARPOS (row->start.string_pos), CHARPOS (row->end.string_pos)); - fprintf (stderr, "%9d %5d\n", row->start.dpvec_index, + fprintf (stderr, " %9d %9d\n", row->start.dpvec_index, row->end.dpvec_index); } @@ -18125,7 +18137,7 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs) ++glyph_end; if (glyph < glyph_end) - fprintf (stderr, " Glyph Type Pos O W Code C Face LR\n"); + fprintf (stderr, " Glyph# Type Pos O W Code C Face LR\n"); for (; glyph < glyph_end; ++glyph) dump_glyph (row, glyph, area); @@ -18137,15 +18149,24 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs) for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) { - char *s = alloca (row->used[area] + 1); + char *s = alloca (row->used[area] + 4); int i; for (i = 0; i < row->used[area]; ++i) { struct glyph *glyph = row->glyphs[area] + i; - if (glyph->type == CHAR_GLYPH - && glyph->u.ch < 0x80 - && glyph->u.ch >= ' ') + if (i == row->used[area] - 1 + && area == TEXT_AREA + && INTEGERP (glyph->object) + && glyph->type == CHAR_GLYPH + && glyph->u.ch == ' ') + { + strcpy (&s[i], "[\\n]"); + i += 4; + } + else if (glyph->type == CHAR_GLYPH + && glyph->u.ch < 0x80 + && glyph->u.ch >= ' ') s[i] = glyph->u.ch; else s[i] = '.'; -- cgit v1.2.3