aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-08-28 08:33:51 +0000
committerGerd Moellmann2001-08-28 08:33:51 +0000
commiteaaa65b0929a85c3c4a39c719476778ab29b7100 (patch)
treed50764242d983a9c5045901dea54c91585bb01f0 /src
parent4b4ea1dce736d58c0c671847bdb278668e8e393a (diff)
downloademacs-eaaa65b0929a85c3c4a39c719476778ab29b7100.tar.gz
emacs-eaaa65b0929a85c3c4a39c719476778ab29b7100.zip
(display_mode_element): Use string_byte_to_char to
determine character positions in strings, use chars_in_text instead of strwidth. (dump_glyph_row) [GLYPH_DEBUG]: Take a glyph row instead of a matrix as parameter; this is easier to use from GDB.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/xdisp.c54
2 files changed, 41 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f4691c88399..51c75f56322 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12001-08-28 Gerd Moellmann <gerd@gnu.org>
2
3 * xdisp.c (display_mode_element): Use string_byte_to_char to
4 determine character positions in strings, use chars_in_text
5 instead of strwidth.
6 (dump_glyph_row) [GLYPH_DEBUG]: Take a glyph row instead of
7 a matrix as parameter; this is easier to use from GDB.
8
12001-08-28 Miles Bader <miles@gnu.org> 92001-08-28 Miles Bader <miles@gnu.org>
2 10
3 * textprop.c (Fprevious_single_char_property_change) 11 * textprop.c (Fprevious_single_char_property_change)
diff --git a/src/xdisp.c b/src/xdisp.c
index 6272eece52f..b7b9712f479 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11892,7 +11892,7 @@ try_window_id (w)
11892 11892
11893#if GLYPH_DEBUG 11893#if GLYPH_DEBUG
11894 11894
11895void dump_glyph_row P_ ((struct glyph_matrix *, int, int)); 11895void dump_glyph_row P_ ((struct glyph_row *, int, int));
11896void dump_glyph_matrix P_ ((struct glyph_matrix *, int)); 11896void dump_glyph_matrix P_ ((struct glyph_matrix *, int));
11897void dump_glyph P_ ((struct glyph_row *, struct glyph *, int)); 11897void dump_glyph P_ ((struct glyph_row *, struct glyph *, int));
11898 11898
@@ -11910,7 +11910,7 @@ dump_glyph_matrix (matrix, glyphs)
11910{ 11910{
11911 int i; 11911 int i;
11912 for (i = 0; i < matrix->nrows; ++i) 11912 for (i = 0; i < matrix->nrows; ++i)
11913 dump_glyph_row (matrix, i, glyphs); 11913 dump_glyph_row (MATRIX_ROW (matrix, i), i, glyphs);
11914} 11914}
11915 11915
11916 11916
@@ -11991,17 +11991,10 @@ dump_glyph (row, glyph, area)
11991 GLYPHS > 1 means show glyphs in long form. */ 11991 GLYPHS > 1 means show glyphs in long form. */
11992 11992
11993void 11993void
11994dump_glyph_row (matrix, vpos, glyphs) 11994dump_glyph_row (row, vpos, glyphs)
11995 struct glyph_matrix *matrix; 11995 struct glyph_row *row;
11996 int vpos, glyphs; 11996 int vpos, glyphs;
11997{ 11997{
11998 struct glyph_row *row;
11999
12000 if (vpos < 0 || vpos >= matrix->nrows)
12001 return;
12002
12003 row = MATRIX_ROW (matrix, vpos);
12004
12005 if (glyphs != 1) 11998 if (glyphs != 1)
12006 { 11999 {
12007 fprintf (stderr, "Row Start End Used oEI><O\\CTZFesm X Y W H V A P\n"); 12000 fprintf (stderr, "Row Start End Used oEI><O\\CTZFesm X Y W H V A P\n");
@@ -12009,7 +12002,7 @@ dump_glyph_row (matrix, vpos, glyphs)
12009 12002
12010 fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d%1.1d%1.1d\ 12003 fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d%1.1d%1.1d\
12011%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n", 12004%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n",
12012 row - matrix->rows, 12005 vpos,
12013 MATRIX_ROW_START_CHARPOS (row), 12006 MATRIX_ROW_START_CHARPOS (row),
12014 MATRIX_ROW_END_CHARPOS (row), 12007 MATRIX_ROW_END_CHARPOS (row),
12015 row->used[TEXT_AREA], 12008 row->used[TEXT_AREA],
@@ -12122,10 +12115,16 @@ GLYPH > 1 or omitted means dump glyphs in long form.")
12122 (row, glyphs) 12115 (row, glyphs)
12123 Lisp_Object row, glyphs; 12116 Lisp_Object row, glyphs;
12124{ 12117{
12118 struct glyph_matrix *matrix;
12119 int vpos;
12120
12125 CHECK_NUMBER (row, 0); 12121 CHECK_NUMBER (row, 0);
12126 dump_glyph_row (XWINDOW (selected_window)->current_matrix, 12122 matrix = XWINDOW (selected_window)->current_matrix;
12127 XINT (row), 12123 vpos = XINT (row);
12128 INTEGERP (glyphs) ? XINT (glyphs) : 2); 12124 if (vpos >= 0 && vpos < matrix->nrows)
12125 dump_glyph_row (MATRIX_ROW (matrix, vpos),
12126 vpos,
12127 INTEGERP (glyphs) ? XINT (glyphs) : 2);
12129 return Qnil; 12128 return Qnil;
12130} 12129}
12131 12130
@@ -12139,8 +12138,14 @@ GLYPH > 1 or omitted means dump glyphs in long form.")
12139 Lisp_Object row, glyphs; 12138 Lisp_Object row, glyphs;
12140{ 12139{
12141 struct frame *sf = SELECTED_FRAME (); 12140 struct frame *sf = SELECTED_FRAME ();
12142 struct glyph_matrix *m = (XWINDOW (sf->tool_bar_window)->current_matrix); 12141 struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix;
12143 dump_glyph_row (m, XINT (row), INTEGERP (glyphs) ? XINT (glyphs) : 2); 12142 int vpos;
12143
12144 CHECK_NUMBER (row, 0);
12145 vpos = XINT (row);
12146 if (vpos >= 0 && vpos < m->nrows)
12147 dump_glyph_row (MATRIX_ROW (m, vpos), vpos,
12148 INTEGERP (glyphs) ? XINT (glyphs) : 2);
12144 return Qnil; 12149 return Qnil;
12145} 12150}
12146 12151
@@ -13378,15 +13383,20 @@ display_mode_element (it, depth, field_width, precision, elt)
13378 is length of string. Don't output more than 13383 is length of string. Don't output more than
13379 PRECISION allows us. */ 13384 PRECISION allows us. */
13380 --this; 13385 --this;
13381 prec = strwidth (last, this - last); 13386
13387 prec = chars_in_text (last, this - last);
13382 if (precision > 0 && prec > precision - n) 13388 if (precision > 0 && prec > precision - n)
13383 prec = precision - n; 13389 prec = precision - n;
13384 13390
13385 if (frame_title_ptr) 13391 if (frame_title_ptr)
13386 n += store_frame_title (last, 0, prec); 13392 n += store_frame_title (last, 0, prec);
13387 else 13393 else
13388 n += display_string (NULL, elt, Qnil, 0, last - lisp_string, 13394 {
13389 it, 0, prec, 0, -1); 13395 int bytepos = last - lisp_string;
13396 int charpos = string_byte_to_char (elt, bytepos);
13397 n += display_string (NULL, elt, Qnil, 0, charpos,
13398 it, 0, prec, 0, -1);
13399 }
13390 } 13400 }
13391 else /* c == '%' */ 13401 else /* c == '%' */
13392 { 13402 {
@@ -13419,8 +13429,10 @@ display_mode_element (it, depth, field_width, precision, elt)
13419 { 13429 {
13420 int nglyphs_before 13430 int nglyphs_before
13421 = it->glyph_row->used[TEXT_AREA]; 13431 = it->glyph_row->used[TEXT_AREA];
13422 int charpos 13432 int bytepos
13423 = percent_position - XSTRING (elt)->data; 13433 = percent_position - XSTRING (elt)->data;
13434 int charpos
13435 = string_byte_to_char (elt, bytepos);
13424 int nwritten 13436 int nwritten
13425 = display_string (spec, Qnil, elt, charpos, 0, it, 13437 = display_string (spec, Qnil, elt, charpos, 0, it,
13426 field, prec, 0, -1); 13438 field, prec, 0, -1);