Mercurial > hg > xemacs-beta
comparison src/redisplay.c @ 5688:b6c506c30f93
Respect face and display table information for the minibuffer prompt.
src/ChangeLog addition:
2012-10-14 Aidan Kehoe <kehoea@parhasard.net>
Respect face and display table information in the minibuffer
prompt. Thanks for the bug report, Nelson Ferreira!
* redisplay.c (struct prop_block):
Add entries representing the minibuffer prompt explicitly to the
union here.
* redisplay.c (add_propagation_runes):
Respect the face and the display table for the minibuffer prompt
here.
* redisplay.c (regenerate_window):
Use the new union members when passing the minibuffer prompt info
to add_propagation_runes().
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 14 Oct 2012 16:14:25 +0100 |
parents | 81fee4aee9b6 |
children | cfc6a8c144f1 |
comparison
equal
deleted
inserted
replaced
5687:965a9ddc915a | 5688:b6c506c30f93 |
---|---|
257 { | 257 { |
258 /* Not used as yet, but could be used to wrap rather than clip glyphs. */ | 258 /* Not used as yet, but could be used to wrap rather than clip glyphs. */ |
259 int width; | 259 int width; |
260 Lisp_Object glyph; | 260 Lisp_Object glyph; |
261 } p_glyph; | 261 } p_glyph; |
262 | |
263 struct | |
264 { | |
265 Lisp_Object preprompt; | |
266 Lisp_Object prompt; | |
267 } p_minibuf_prompt; | |
262 | 268 |
263 } data; | 269 } data; |
264 }; | 270 }; |
265 | 271 |
266 typedef struct | 272 typedef struct |
1690 break; | 1696 break; |
1691 case PROP_MINIBUF_PROMPT: | 1697 case PROP_MINIBUF_PROMPT: |
1692 { | 1698 { |
1693 face_index old_findex = data->findex; | 1699 face_index old_findex = data->findex; |
1694 Bytebpos byte_old_charpos = data->byte_charpos; | 1700 Bytebpos byte_old_charpos = data->byte_charpos; |
1695 | 1701 Boolint stop_after = NILP (pb->data.p_minibuf_prompt.preprompt); |
1696 data->findex = DEFAULT_INDEX; | 1702 Lisp_Object str = stop_after ? pb->data.p_minibuf_prompt.prompt |
1703 : pb->data.p_minibuf_prompt.preprompt; | |
1704 struct window *w = XWINDOW (data->window); | |
1705 | |
1697 data->byte_charpos = 0; | 1706 data->byte_charpos = 0; |
1698 data->cursor_type = NO_CURSOR; | 1707 data->cursor_type = NO_CURSOR; |
1699 | 1708 |
1700 while (pb->data.p_string.len > 0) | 1709 /* This doesn't handle begin-glyphs and end-glyphs and so on. It |
1701 { | 1710 may be reasonable not to, given that we're a "propagation |
1702 data->ch = itext_ichar (pb->data.p_string.str); | 1711 glyph", but it's not intuitively clear either way. It is |
1703 add_failed = add_ichar_rune (data); | 1712 clear that it should handle the face and the display |
1704 | 1713 table. */ |
1705 if (add_failed) | 1714 |
1706 { | 1715 while (STRINGP (str)) |
1707 data->findex = old_findex; | 1716 { |
1708 data->byte_charpos = byte_old_charpos; | 1717 Ibyte *pstart = XSTRING_DATA (str), *pp = pstart, |
1709 goto oops_no_more_space; | 1718 *pend = pstart + XSTRING_LENGTH (str); |
1719 struct extent_fragment *ef | |
1720 = extent_fragment_new (str, XFRAME (w->frame)); | |
1721 | |
1722 while (pp < pend) | |
1723 { | |
1724 Lisp_Object face_dt, window_dt, entry = Qnil; | |
1725 face_index new_findex | |
1726 = data->findex = extent_fragment_update (w, ef, | |
1727 pp - pstart, | |
1728 Qnil); | |
1729 | |
1730 data->ch = itext_ichar (pp); | |
1731 get_display_tables (w, new_findex, &face_dt, &window_dt); | |
1732 | |
1733 if (!NILP (face_dt) || !NILP (window_dt)) | |
1734 { | |
1735 entry = display_table_entry (data->ch, face_dt, | |
1736 window_dt); | |
1737 } | |
1738 | |
1739 /* If there is a display table entry for it, hand it off | |
1740 to add_disp_table_entry_runes and let it worry about | |
1741 it. */ | |
1742 if (!NILP (entry) && !EQ (entry, make_char (data->ch))) | |
1743 { | |
1744 add_failed = add_disp_table_entry_runes (data, entry); | |
1745 } | |
1746 else | |
1747 { | |
1748 add_failed = add_ichar_rune (data); | |
1749 } | |
1750 | |
1751 if (add_failed) | |
1752 { | |
1753 data->findex = old_findex; | |
1754 data->byte_charpos = byte_old_charpos; | |
1755 extent_fragment_delete (ef); | |
1756 goto oops_no_more_space; | |
1757 } | |
1758 | |
1759 INC_IBYTEPTR (pp); | |
1710 } | 1760 } |
1711 else | 1761 |
1712 { | 1762 extent_fragment_delete (ef); |
1713 /* Complicated equivalent of ptr++, len-- */ | 1763 |
1714 Ibyte *oldpos = pb->data.p_string.str; | 1764 if (stop_after) |
1715 INC_IBYTEPTR (pb->data.p_string.str); | 1765 { |
1716 pb->data.p_string.len -= pb->data.p_string.str - oldpos; | 1766 break; |
1717 } | 1767 } |
1718 } | 1768 |
1769 str = pb->data.p_minibuf_prompt.prompt; | |
1770 stop_after = 1; | |
1771 } | |
1719 | 1772 |
1720 data->findex = old_findex; | 1773 data->findex = old_findex; |
1721 /* ##### FIXME FIXME FIXME -- Upon successful return from | 1774 /* ##### FIXME FIXME FIXME -- Upon successful return from |
1722 this function, data->byte_charpos is automatically incremented. | 1775 this function, data->byte_charpos is automatically incremented. |
1723 However, we don't want that to happen if we were adding | 1776 However, we don't want that to happen if we were adding |
5521 && (!NILP (Vminibuf_prompt) || !NILP (Vminibuf_preprompt)) | 5574 && (!NILP (Vminibuf_prompt) || !NILP (Vminibuf_preprompt)) |
5522 && !echo_area_active (f) | 5575 && !echo_area_active (f) |
5523 && start_pos == BUF_BEGV (b)) | 5576 && start_pos == BUF_BEGV (b)) |
5524 { | 5577 { |
5525 struct prop_block pb; | 5578 struct prop_block pb; |
5526 Lisp_Object string; | |
5527 prop = Dynarr_new (prop_block); | 5579 prop = Dynarr_new (prop_block); |
5528 | 5580 |
5529 string = concat2 (Vminibuf_preprompt, Vminibuf_prompt); | |
5530 pb.type = PROP_MINIBUF_PROMPT; | 5581 pb.type = PROP_MINIBUF_PROMPT; |
5531 pb.data.p_string.str = XSTRING_DATA (string); | 5582 pb.data.p_minibuf_prompt.preprompt = Vminibuf_preprompt; |
5532 pb.data.p_string.len = XSTRING_LENGTH (string); | 5583 pb.data.p_minibuf_prompt.prompt = Vminibuf_prompt; |
5533 Dynarr_add (prop, pb); | 5584 Dynarr_add (prop, pb); |
5534 } | 5585 } |
5535 else | 5586 else |
5536 prop = 0; | 5587 prop = 0; |
5537 | 5588 |