aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2013-01-07 00:03:49 +0100
committerJoakim Verona2013-01-07 00:03:49 +0100
commitbe73be611d160876f9df633ff3a2d86eb78f65c7 (patch)
treeda818705af78c54104d99583e7895d7e0d0f5cb6 /src
parentb18e01b65e651d3b626b4edcaaa2aa636fe25b69 (diff)
parent84f6744ab74d1c5f201e88273fc6faa65956a440 (diff)
downloademacs-be73be611d160876f9df633ff3a2d86eb78f65c7.tar.gz
emacs-be73be611d160876f9df633ff3a2d86eb78f65c7.zip
auto upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog18
-rw-r--r--src/keyboard.c146
-rw-r--r--src/xdisp.c65
3 files changed, 139 insertions, 90 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 8fc876e248c..3b0b295e695 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12013-01-06 Chong Yidong <cyd@gnu.org>
2
3 * keyboard.c (echo_add_char): New function, factored out from
4 echo_char. Don't add a space if the previous echo string was
5 empty (Bug#13255).
6 (echo_char): Use it.
7 (read_key_sequence): When echoing mock input, ensure that the
8 trailing dash is properly added.
9
102013-01-05 Eli Zaretskii <eliz@gnu.org>
11
12 * xdisp.c (dump_glyph): Align glyph data better. Use "pD" instead
13 of a non-portable "t" to print ptrdiff_t values. Allow up to 9
14 digits for buffer positions, before misalignment starts. Display
15 "0" for integer "object" field.
16 (dump_glyph_row): Adapt the header line to changes in dump_glyph.
17 Display the newline glyph more unambiguously.
18
12013-01-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 192013-01-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 20
3 * nsterm.m (ns_draw_underwave): 21 * nsterm.m (ns_draw_underwave):
diff --git a/src/keyboard.c b/src/keyboard.c
index e11ed20d2a0..69463f45034 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -500,97 +500,103 @@ kset_system_key_syms (struct kboard *kb, Lisp_Object val)
500} 500}
501 501
502 502
503/* Add C to the echo string, if echoing is going on. 503/* Add C to the echo string, without echoing it immediately. C can be
504 C can be a character, which is printed prettily ("M-C-x" and all that 504 a character, which is pretty-printed, or a symbol, whose name is
505 jazz), or a symbol, whose name is printed. */ 505 printed. */
506 506
507static void 507static void
508echo_char (Lisp_Object c) 508echo_add_char (Lisp_Object c)
509{ 509{
510 if (current_kboard->immediate_echo) 510 int size = KEY_DESCRIPTION_SIZE + 100;
511 { 511 char *buffer = alloca (size);
512 int size = KEY_DESCRIPTION_SIZE + 100; 512 char *ptr = buffer;
513 char *buffer = alloca (size); 513 Lisp_Object echo_string;
514 char *ptr = buffer;
515 Lisp_Object echo_string;
516 514
517 echo_string = KVAR (current_kboard, echo_string); 515 echo_string = KVAR (current_kboard, echo_string);
518 516
519 /* If someone has passed us a composite event, use its head symbol. */ 517 /* If someone has passed us a composite event, use its head symbol. */
520 c = EVENT_HEAD (c); 518 c = EVENT_HEAD (c);
521 519
522 if (INTEGERP (c)) 520 if (INTEGERP (c))
521 ptr = push_key_description (XINT (c), ptr);
522 else if (SYMBOLP (c))
523 {
524 Lisp_Object name = SYMBOL_NAME (c);
525 int nbytes = SBYTES (name);
526
527 if (size - (ptr - buffer) < nbytes)
523 { 528 {
524 ptr = push_key_description (XINT (c), ptr); 529 int offset = ptr - buffer;
530 size = max (2 * size, size + nbytes);
531 buffer = alloca (size);
532 ptr = buffer + offset;
525 } 533 }
526 else if (SYMBOLP (c))
527 {
528 Lisp_Object name = SYMBOL_NAME (c);
529 int nbytes = SBYTES (name);
530 534
531 if (size - (ptr - buffer) < nbytes) 535 ptr += copy_text (SDATA (name), (unsigned char *) ptr, nbytes,
532 { 536 STRING_MULTIBYTE (name), 1);
533 int offset = ptr - buffer; 537 }
534 size = max (2 * size, size + nbytes);
535 buffer = alloca (size);
536 ptr = buffer + offset;
537 }
538 538
539 ptr += copy_text (SDATA (name), (unsigned char *) ptr, nbytes, 539 if ((NILP (echo_string) || SCHARS (echo_string) == 0)
540 STRING_MULTIBYTE (name), 1); 540 && help_char_p (c))
541 } 541 {
542 const char *text = " (Type ? for further options)";
543 int len = strlen (text);
542 544
543 if ((NILP (echo_string) || SCHARS (echo_string) == 0) 545 if (size - (ptr - buffer) < len)
544 && help_char_p (c))
545 { 546 {
546 const char *text = " (Type ? for further options)"; 547 int offset = ptr - buffer;
547 int len = strlen (text); 548 size += len;
548 549 buffer = alloca (size);
549 if (size - (ptr - buffer) < len) 550 ptr = buffer + offset;
550 {
551 int offset = ptr - buffer;
552 size += len;
553 buffer = alloca (size);
554 ptr = buffer + offset;
555 }
556
557 memcpy (ptr, text, len);
558 ptr += len;
559 } 551 }
560 552
561 /* Replace a dash from echo_dash with a space, otherwise 553 memcpy (ptr, text, len);
562 add a space at the end as a separator between keys. */ 554 ptr += len;
563 if (STRINGP (echo_string) 555 }
564 && SCHARS (echo_string) > 1)
565 {
566 Lisp_Object last_char, prev_char, idx;
567 556
568 idx = make_number (SCHARS (echo_string) - 2); 557 /* Replace a dash from echo_dash with a space, otherwise add a space
569 prev_char = Faref (echo_string, idx); 558 at the end as a separator between keys. */
559 if (STRINGP (echo_string) && SCHARS (echo_string) > 1)
560 {
561 Lisp_Object last_char, prev_char, idx;
570 562
571 idx = make_number (SCHARS (echo_string) - 1); 563 idx = make_number (SCHARS (echo_string) - 2);
572 last_char = Faref (echo_string, idx); 564 prev_char = Faref (echo_string, idx);
573 565
574 /* We test PREV_CHAR to make sure this isn't the echoing 566 idx = make_number (SCHARS (echo_string) - 1);
575 of a minus-sign. */ 567 last_char = Faref (echo_string, idx);
576 if (XINT (last_char) == '-' && XINT (prev_char) != ' ') 568
577 Faset (echo_string, idx, make_number (' ')); 569 /* We test PREV_CHAR to make sure this isn't the echoing of a
578 else 570 minus-sign. */
579 echo_string = concat2 (echo_string, build_string (" ")); 571 if (XINT (last_char) == '-' && XINT (prev_char) != ' ')
580 } 572 Faset (echo_string, idx, make_number (' '));
581 else if (STRINGP (echo_string)) 573 else
582 echo_string = concat2 (echo_string, build_string (" ")); 574 echo_string = concat2 (echo_string, build_string (" "));
575 }
576 else if (STRINGP (echo_string) && SCHARS (echo_string) > 0)
577 echo_string = concat2 (echo_string, build_string (" "));
583 578
584 kset_echo_string 579 kset_echo_string
585 (current_kboard, 580 (current_kboard,
586 concat2 (echo_string, make_string (buffer, ptr - buffer))); 581 concat2 (echo_string, make_string (buffer, ptr - buffer)));
582}
583
584/* Add C to the echo string, if echoing is going on. C can be a
585 character or a symbol. */
587 586
587static void
588echo_char (Lisp_Object c)
589{
590 if (current_kboard->immediate_echo)
591 {
592 echo_add_char (c);
588 echo_now (); 593 echo_now ();
589 } 594 }
590} 595}
591 596
592/* Temporarily add a dash to the end of the echo string if it's not 597/* Temporarily add a dash to the end of the echo string if it's not
593 empty, so that it serves as a mini-prompt for the very next character. */ 598 empty, so that it serves as a mini-prompt for the very next
599 character. */
594 600
595static void 601static void
596echo_dash (void) 602echo_dash (void)
@@ -9237,8 +9243,12 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9237 key = keybuf[t]; 9243 key = keybuf[t];
9238 add_command_key (key); 9244 add_command_key (key);
9239 if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 9245 if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
9240 && NILP (Fzerop (Vecho_keystrokes))) 9246 && NILP (Fzerop (Vecho_keystrokes))
9241 echo_char (key); 9247 && current_kboard->immediate_echo)
9248 {
9249 echo_add_char (key);
9250 echo_dash ();
9251 }
9242 } 9252 }
9243 9253
9244 /* If not, we should actually read a character. */ 9254 /* If not, we should actually read a character. */
diff --git a/src/xdisp.c b/src/xdisp.c
index c9096339fcc..880e25334d1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -18007,18 +18007,23 @@ dump_glyph_matrix (struct glyph_matrix *matrix, int glyphs)
18007void 18007void
18008dump_glyph (struct glyph_row *row, struct glyph *glyph, int area) 18008dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
18009{ 18009{
18010 if (glyph->type == CHAR_GLYPH) 18010 if (glyph->type == CHAR_GLYPH
18011 || glyph->type == GLYPHLESS_GLYPH)
18011 { 18012 {
18012 fprintf (stderr, 18013 fprintf (stderr,
18013 " %5td %4c %6"pI"d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", 18014 " %5"pD"d %c %9"pI"d %c %3d 0x%06x %c %4d %1.1d%1.1d\n",
18014 glyph - row->glyphs[TEXT_AREA], 18015 glyph - row->glyphs[TEXT_AREA],
18015 'C', 18016 (glyph->type == CHAR_GLYPH
18017 ? 'C'
18018 : 'G'),
18016 glyph->charpos, 18019 glyph->charpos,
18017 (BUFFERP (glyph->object) 18020 (BUFFERP (glyph->object)
18018 ? 'B' 18021 ? 'B'
18019 : (STRINGP (glyph->object) 18022 : (STRINGP (glyph->object)
18020 ? 'S' 18023 ? 'S'
18021 : '-')), 18024 : (INTEGERP (glyph->object)
18025 ? '0'
18026 : '-'))),
18022 glyph->pixel_width, 18027 glyph->pixel_width,
18023 glyph->u.ch, 18028 glyph->u.ch,
18024 (glyph->u.ch < 0x80 && glyph->u.ch >= ' ' 18029 (glyph->u.ch < 0x80 && glyph->u.ch >= ' '
@@ -18031,7 +18036,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
18031 else if (glyph->type == STRETCH_GLYPH) 18036 else if (glyph->type == STRETCH_GLYPH)
18032 { 18037 {
18033 fprintf (stderr, 18038 fprintf (stderr,
18034 " %5td %4c %6"pI"d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", 18039 " %5"pD"d %c %9"pI"d %c %3d 0x%06x %c %4d %1.1d%1.1d\n",
18035 glyph - row->glyphs[TEXT_AREA], 18040 glyph - row->glyphs[TEXT_AREA],
18036 'S', 18041 'S',
18037 glyph->charpos, 18042 glyph->charpos,
@@ -18039,10 +18044,12 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
18039 ? 'B' 18044 ? 'B'
18040 : (STRINGP (glyph->object) 18045 : (STRINGP (glyph->object)
18041 ? 'S' 18046 ? 'S'
18042 : '-')), 18047 : (INTEGERP (glyph->object)
18048 ? '0'
18049 : '-'))),
18043 glyph->pixel_width, 18050 glyph->pixel_width,
18044 0, 18051 0,
18045 '.', 18052 ' ',
18046 glyph->face_id, 18053 glyph->face_id,
18047 glyph->left_box_line_p, 18054 glyph->left_box_line_p,
18048 glyph->right_box_line_p); 18055 glyph->right_box_line_p);
@@ -18050,7 +18057,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
18050 else if (glyph->type == IMAGE_GLYPH) 18057 else if (glyph->type == IMAGE_GLYPH)
18051 { 18058 {
18052 fprintf (stderr, 18059 fprintf (stderr,
18053 " %5td %4c %6"pI"d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", 18060 " %5"pD"d %c %9"pI"d %c %3d 0x%06x %c %4d %1.1d%1.1d\n",
18054 glyph - row->glyphs[TEXT_AREA], 18061 glyph - row->glyphs[TEXT_AREA],
18055 'I', 18062 'I',
18056 glyph->charpos, 18063 glyph->charpos,
@@ -18058,7 +18065,9 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
18058 ? 'B' 18065 ? 'B'
18059 : (STRINGP (glyph->object) 18066 : (STRINGP (glyph->object)
18060 ? 'S' 18067 ? 'S'
18061 : '-')), 18068 : (INTEGERP (glyph->object)
18069 ? '0'
18070 : '-'))),
18062 glyph->pixel_width, 18071 glyph->pixel_width,
18063 glyph->u.img_id, 18072 glyph->u.img_id,
18064 '.', 18073 '.',
@@ -18069,7 +18078,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
18069 else if (glyph->type == COMPOSITE_GLYPH) 18078 else if (glyph->type == COMPOSITE_GLYPH)
18070 { 18079 {
18071 fprintf (stderr, 18080 fprintf (stderr,
18072 " %5td %4c %6"pI"d %c %3d 0x%05x", 18081 " %5"pD"d %c %9"pI"d %c %3d 0x%06x",
18073 glyph - row->glyphs[TEXT_AREA], 18082 glyph - row->glyphs[TEXT_AREA],
18074 '+', 18083 '+',
18075 glyph->charpos, 18084 glyph->charpos,
@@ -18077,7 +18086,9 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
18077 ? 'B' 18086 ? 'B'
18078 : (STRINGP (glyph->object) 18087 : (STRINGP (glyph->object)
18079 ? 'S' 18088 ? 'S'
18080 : '-')), 18089 : (INTEGERP (glyph->object)
18090 ? '0'
18091 : '-'))),
18081 glyph->pixel_width, 18092 glyph->pixel_width,
18082 glyph->u.cmp.id); 18093 glyph->u.cmp.id);
18083 if (glyph->u.cmp.automatic) 18094 if (glyph->u.cmp.automatic)
@@ -18125,10 +18136,10 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs)
18125{ 18136{
18126 if (glyphs != 1) 18137 if (glyphs != 1)
18127 { 18138 {
18128 fprintf (stderr, "Row Start End Used oE><\\CTZFesm X Y W H V A P\n"); 18139 fprintf (stderr, "Row Start End Used oE><\\CTZFesm X Y W H V A P\n");
18129 fprintf (stderr, "======================================================================\n"); 18140 fprintf (stderr, "==============================================================================\n");
18130 18141
18131 fprintf (stderr, "%3d %5"pI"d %5"pI"d %4d %1.1d%1.1d%1.1d%1.1d\ 18142 fprintf (stderr, "%3d %9"pI"d %9"pI"d %4d %1.1d%1.1d%1.1d%1.1d\
18132%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n", 18143%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d %4d %4d %4d %4d %4d %4d %4d\n",
18133 vpos, 18144 vpos,
18134 MATRIX_ROW_START_CHARPOS (row), 18145 MATRIX_ROW_START_CHARPOS (row),
@@ -18153,13 +18164,14 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs)
18153 row->visible_height, 18164 row->visible_height,
18154 row->ascent, 18165 row->ascent,
18155 row->phys_ascent); 18166 row->phys_ascent);
18156 fprintf (stderr, "%9"pD"d %5"pD"d\t%5d\n", row->start.overlay_string_index, 18167 /* The next 3 lines should align to "Start" in the header. */
18168 fprintf (stderr, " %9"pD"d %9"pD"d\t%5d\n", row->start.overlay_string_index,
18157 row->end.overlay_string_index, 18169 row->end.overlay_string_index,
18158 row->continuation_lines_width); 18170 row->continuation_lines_width);
18159 fprintf (stderr, "%9"pI"d %5"pI"d\n", 18171 fprintf (stderr, " %9"pI"d %9"pI"d\n",
18160 CHARPOS (row->start.string_pos), 18172 CHARPOS (row->start.string_pos),
18161 CHARPOS (row->end.string_pos)); 18173 CHARPOS (row->end.string_pos));
18162 fprintf (stderr, "%9d %5d\n", row->start.dpvec_index, 18174 fprintf (stderr, " %9d %9d\n", row->start.dpvec_index,
18163 row->end.dpvec_index); 18175 row->end.dpvec_index);
18164 } 18176 }
18165 18177
@@ -18177,7 +18189,7 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs)
18177 ++glyph_end; 18189 ++glyph_end;
18178 18190
18179 if (glyph < glyph_end) 18191 if (glyph < glyph_end)
18180 fprintf (stderr, " Glyph Type Pos O W Code C Face LR\n"); 18192 fprintf (stderr, " Glyph# Type Pos O W Code C Face LR\n");
18181 18193
18182 for (; glyph < glyph_end; ++glyph) 18194 for (; glyph < glyph_end; ++glyph)
18183 dump_glyph (row, glyph, area); 18195 dump_glyph (row, glyph, area);
@@ -18189,15 +18201,24 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs)
18189 18201
18190 for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) 18202 for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
18191 { 18203 {
18192 char *s = alloca (row->used[area] + 1); 18204 char *s = alloca (row->used[area] + 4);
18193 int i; 18205 int i;
18194 18206
18195 for (i = 0; i < row->used[area]; ++i) 18207 for (i = 0; i < row->used[area]; ++i)
18196 { 18208 {
18197 struct glyph *glyph = row->glyphs[area] + i; 18209 struct glyph *glyph = row->glyphs[area] + i;
18198 if (glyph->type == CHAR_GLYPH 18210 if (i == row->used[area] - 1
18199 && glyph->u.ch < 0x80 18211 && area == TEXT_AREA
18200 && glyph->u.ch >= ' ') 18212 && INTEGERP (glyph->object)
18213 && glyph->type == CHAR_GLYPH
18214 && glyph->u.ch == ' ')
18215 {
18216 strcpy (&s[i], "[\\n]");
18217 i += 4;
18218 }
18219 else if (glyph->type == CHAR_GLYPH
18220 && glyph->u.ch < 0x80
18221 && glyph->u.ch >= ' ')
18201 s[i] = glyph->u.ch; 18222 s[i] = glyph->u.ch;
18202 else 18223 else
18203 s[i] = '.'; 18224 s[i] = '.';