[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: address@hidden: Overlay string not displayed on text with `display'
From: |
Kim F. Storm |
Subject: |
Re: address@hidden: Overlay string not displayed on text with `display' property] |
Date: |
Mon, 12 Jun 2006 11:26:07 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
address@hidden (Kim F. Storm) writes:
> YAMAMOTO Mitsuharu <address@hidden> writes:
>
>> I agree with you about not making nontrivial changes before the
>> release. But I don't think that it is not worth the trouble in the
>> long term. First, images are usually displayed using the `display'
>> property, and overlay strings are not shown before them. Second, the
>> `composition' property shows the similar behavior as I mentioned in
>> http://lists.gnu.org/archive/html/emacs-devel/2006-06/msg00119.html.
>
> So it may be a question of specifically handling before-string and
> after-string properties at the boundaries of display and composition
> properties. That _may_ be doable...
Look at this small example:
; emacs -Q -D
(setq overlay (make-overlay 1 3))
(overlay-put overlay 'before-string (propertize "BE" 'face 'bold))
(overlay-put overlay 'after-string (propertize "AF" 'display
(propertize "XY" 'face 'underline)))
(put-text-property 1 3 'display "DISP")
It seems to work fine With the following patch (not trivial, but
not extremely complex either):
*** dispextern.h 28 May 2006 21:09:42 +0200 1.218
--- dispextern.h 12 Jun 2006 11:15:49 +0200
***************
*** 1819,1824 ****
--- 1819,1826 ----
NUM_IT_METHODS
};
+ #define IT_STACK_SIZE 4
+
struct it
{
/* The window in which we iterate over current_buffer (or a string). */
***************
*** 1942,1948 ****
short voffset;
Lisp_Object font_height;
}
! stack[2];
/* Stack pointer. */
int sp;
--- 1944,1950 ----
short voffset;
Lisp_Object font_height;
}
! stack[IT_STACK_SIZE];
/* Stack pointer. */
int sp;
*** xdisp.c 03 Jun 2006 23:54:30 +0200 1.1102
--- xdisp.c 12 Jun 2006 11:23:18 +0200
***************
*** 916,921 ****
--- 916,922 ----
static void compute_line_metrics P_ ((struct it *));
static void run_redisplay_end_trigger_hook P_ ((struct it *));
static int get_overlay_strings P_ ((struct it *, int));
+ static int get_overlay_strings_1 P_ ((struct it *, int, int));
static void next_overlay_string P_ ((struct it *));
static void reseat P_ ((struct it *, struct text_pos, int));
static void reseat_1 P_ ((struct it *, struct text_pos, int));
***************
*** 3021,3027 ****
if (handled == HANDLED_RECOMPUTE_PROPS)
break;
else if (handled == HANDLED_RETURN)
! return;
else if (handled == HANDLED_OVERLAY_STRING_CONSUMED)
handle_overlay_change_p = 0;
}
--- 3022,3038 ----
if (handled == HANDLED_RECOMPUTE_PROPS)
break;
else if (handled == HANDLED_RETURN)
! {
! /* We still want to show before and after strings from
! overlays even if the actual buffer text is replaced. */
! if (!handle_overlay_change_p || it->sp > 1)
! return;
! if (!get_overlay_strings_1 (it, 0, 0))
! return;
! handle_overlay_change_p = 0;
! handled = HANDLED_RECOMPUTE_PROPS;
! break;
! }
else if (handled == HANDLED_OVERLAY_STRING_CONSUMED)
handle_overlay_change_p = 0;
}
***************
*** 4545,4555 ****
pop_it (it);
xassert (it->stop_charpos >= BEGV
&& it->stop_charpos <= it->end_charpos);
! it->string = Qnil;
it->current.overlay_string_index = -1;
- SET_TEXT_POS (it->current.string_pos, -1, -1);
it->n_overlay_strings = 0;
- it->method = GET_FROM_BUFFER;
/* If we're at the end of the buffer, record that we have
processed the overlay strings there already, so that
--- 4556,4569 ----
pop_it (it);
xassert (it->stop_charpos >= BEGV
&& it->stop_charpos <= it->end_charpos);
! if (it->sp == 0)
! {
! it->string = Qnil;
! SET_TEXT_POS (it->current.string_pos, -1, -1);
! it->method = GET_FROM_BUFFER;
! }
it->current.overlay_string_index = -1;
it->n_overlay_strings = 0;
/* If we're at the end of the buffer, record that we have
processed the overlay strings there already, so that
***************
*** 4805,4811 ****
least one overlay string was found. */
static int
! get_overlay_strings (it, charpos)
struct it *it;
int charpos;
{
--- 4819,4825 ----
least one overlay string was found. */
static int
! get_overlay_strings_1 (it, charpos, compute_stop_p)
struct it *it;
int charpos;
{
***************
*** 4827,4838 ****
/* Make sure we know settings in current_buffer, so that we can
restore meaningful values when we're done with the overlay
strings. */
! compute_stop_pos (it);
xassert (it->face_id >= 0);
/* Save IT's settings. They are restored after all overlay
strings have been processed. */
! xassert (it->sp == 0);
push_it (it);
/* Set up IT to deliver display elements from the first overlay
--- 4841,4853 ----
/* Make sure we know settings in current_buffer, so that we can
restore meaningful values when we're done with the overlay
strings. */
! if (compute_stop_p)
! compute_stop_pos (it);
xassert (it->face_id >= 0);
/* Save IT's settings. They are restored after all overlay
strings have been processed. */
! xassert (!compute_stop_pos || it->sp == 0);
push_it (it);
/* Set up IT to deliver display elements from the first overlay
***************
*** 4844,4851 ****
it->end_charpos = SCHARS (it->string);
it->multibyte_p = STRING_MULTIBYTE (it->string);
it->method = GET_FROM_STRING;
}
! else
{
it->string = Qnil;
it->current.overlay_string_index = -1;
--- 4859,4876 ----
it->end_charpos = SCHARS (it->string);
it->multibyte_p = STRING_MULTIBYTE (it->string);
it->method = GET_FROM_STRING;
+ return 1;
}
!
! return 0;
! }
!
! static int
! get_overlay_strings (it, charpos)
! struct it *it;
! int charpos;
! {
! if (!get_overlay_strings_1 (it, charpos, 1))
{
it->string = Qnil;
it->current.overlay_string_index = -1;
***************
*** 4875,4881 ****
{
struct iterator_stack_entry *p;
! xassert (it->sp < 2);
p = it->stack + it->sp;
p->stop_charpos = it->stop_charpos;
--- 4900,4906 ----
{
struct iterator_stack_entry *p;
! xassert (it->sp < IT_STACK_SIZE);
p = it->stack + it->sp;
p->stop_charpos = it->stop_charpos;
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Re: address@hidden: Overlay string not displayed on text with `display' property], Kim F. Storm, 2006/06/10
- Re: address@hidden: Overlay string not displayed on text with `display' property], Kim F. Storm, 2006/06/11
- Re: address@hidden: Overlay string not displayed on text with `display' property], Richard Stallman, 2006/06/11
- Re: address@hidden: Overlay string not displayed on text with `display' property], YAMAMOTO Mitsuharu, 2006/06/12
- Re: address@hidden: Overlay string not displayed on text with `display' property], Kim F. Storm, 2006/06/12
- Re: address@hidden: Overlay string not displayed on text with `display' property],
Kim F. Storm <=
- Re: address@hidden: Overlay string not displayed on text with `display' property], Miles Bader, 2006/06/12
- Re: address@hidden: Overlay string not displayed on text with `display' property], YAMAMOTO Mitsuharu, 2006/06/12
- Re: address@hidden: Overlay string not displayed on text with `display' property], Kim F. Storm, 2006/06/13
- Re: address@hidden: Overlay string not displayed on text with `display' property], YAMAMOTO Mitsuharu, 2006/06/13
- Re: address@hidden: Overlay string not displayed on text with `display' property], Kim F. Storm, 2006/06/15
- Re: address@hidden: Overlay string not displayed on text with `display' property], YAMAMOTO Mitsuharu, 2006/06/15
- Re: address@hidden: Overlay string not displayed on text with `display' property], Kim F. Storm, 2006/06/16
- Re: address@hidden: Overlay string not displayed on text with `display' property], YAMAMOTO Mitsuharu, 2006/06/19
- Re: address@hidden: Overlay string not displayed on text with `display' property], Kim F. Storm, 2006/06/21
- Re: address@hidden: Overlay string not displayed on text with `display' property], YAMAMOTO Mitsuharu, 2006/06/21