Mercurial > hg > xemacs-beta
changeset 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 | 965a9ddc915a |
children | 7371081ce8f7 |
files | src/ChangeLog src/redisplay.c |
diffstat | 2 files changed, 89 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Oct 13 01:09:35 2012 +0200 +++ b/src/ChangeLog Sun Oct 14 16:14:25 2012 +0100 @@ -1,3 +1,17 @@ +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(). + 2012-09-16 Aidan Kehoe <kehoea@parhasard.net> * editfns.c (Fformat_time_string):
--- a/src/redisplay.c Sat Oct 13 01:09:35 2012 +0200 +++ b/src/redisplay.c Sun Oct 14 16:14:25 2012 +0100 @@ -259,6 +259,12 @@ int width; Lisp_Object glyph; } p_glyph; + + struct + { + Lisp_Object preprompt; + Lisp_Object prompt; + } p_minibuf_prompt; } data; }; @@ -1692,30 +1698,77 @@ { face_index old_findex = data->findex; Bytebpos byte_old_charpos = data->byte_charpos; - - data->findex = DEFAULT_INDEX; + Boolint stop_after = NILP (pb->data.p_minibuf_prompt.preprompt); + Lisp_Object str = stop_after ? pb->data.p_minibuf_prompt.prompt + : pb->data.p_minibuf_prompt.preprompt; + struct window *w = XWINDOW (data->window); + data->byte_charpos = 0; data->cursor_type = NO_CURSOR; - while (pb->data.p_string.len > 0) - { - data->ch = itext_ichar (pb->data.p_string.str); - add_failed = add_ichar_rune (data); - - if (add_failed) - { - data->findex = old_findex; - data->byte_charpos = byte_old_charpos; - goto oops_no_more_space; + /* This doesn't handle begin-glyphs and end-glyphs and so on. It + may be reasonable not to, given that we're a "propagation + glyph", but it's not intuitively clear either way. It is + clear that it should handle the face and the display + table. */ + + while (STRINGP (str)) + { + Ibyte *pstart = XSTRING_DATA (str), *pp = pstart, + *pend = pstart + XSTRING_LENGTH (str); + struct extent_fragment *ef + = extent_fragment_new (str, XFRAME (w->frame)); + + while (pp < pend) + { + Lisp_Object face_dt, window_dt, entry = Qnil; + face_index new_findex + = data->findex = extent_fragment_update (w, ef, + pp - pstart, + Qnil); + + data->ch = itext_ichar (pp); + get_display_tables (w, new_findex, &face_dt, &window_dt); + + if (!NILP (face_dt) || !NILP (window_dt)) + { + entry = display_table_entry (data->ch, face_dt, + window_dt); + } + + /* If there is a display table entry for it, hand it off + to add_disp_table_entry_runes and let it worry about + it. */ + if (!NILP (entry) && !EQ (entry, make_char (data->ch))) + { + add_failed = add_disp_table_entry_runes (data, entry); + } + else + { + add_failed = add_ichar_rune (data); + } + + if (add_failed) + { + data->findex = old_findex; + data->byte_charpos = byte_old_charpos; + extent_fragment_delete (ef); + goto oops_no_more_space; + } + + INC_IBYTEPTR (pp); } - else - { - /* Complicated equivalent of ptr++, len-- */ - Ibyte *oldpos = pb->data.p_string.str; - INC_IBYTEPTR (pb->data.p_string.str); - pb->data.p_string.len -= pb->data.p_string.str - oldpos; - } - } + + extent_fragment_delete (ef); + + if (stop_after) + { + break; + } + + str = pb->data.p_minibuf_prompt.prompt; + stop_after = 1; + } data->findex = old_findex; /* ##### FIXME FIXME FIXME -- Upon successful return from @@ -5523,13 +5576,11 @@ && start_pos == BUF_BEGV (b)) { struct prop_block pb; - Lisp_Object string; prop = Dynarr_new (prop_block); - string = concat2 (Vminibuf_preprompt, Vminibuf_prompt); pb.type = PROP_MINIBUF_PROMPT; - pb.data.p_string.str = XSTRING_DATA (string); - pb.data.p_string.len = XSTRING_LENGTH (string); + pb.data.p_minibuf_prompt.preprompt = Vminibuf_preprompt; + pb.data.p_minibuf_prompt.prompt = Vminibuf_prompt; Dynarr_add (prop, pb); } else