emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] xwidget updated (1d8b8a2 -> 5f46725)


From: Eli Zaretskii
Subject: Re: [Emacs-diffs] xwidget updated (1d8b8a2 -> 5f46725)
Date: Sat, 17 Jan 2015 20:39:19 +0200

> Date: Sat, 17 Jan 2015 20:04:07 +0200
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden, address@hidden
> 
> > From: address@hidden
> > Cc: address@hidden,  address@hidden
> > Date: Sat, 17 Jan 2015 18:40:48 +0100
> > 
> > Now I tried the same test, but with an image. It behaves the same way!
> 
> Hmm... yes, I see that, too.
> 
> > So this would seem to indicate a number of possibilities:
> > 
> > - My test is somewhow flawed. Perhaps  (set (make-local-variable
> >   'bidi-paragraph-direction) 'right-to-left) isnt supposed to affect
> >   images and xwidgets etc.
> > 
> > - my xwidget code is so flawed that it affects the image code where it
> >   shouldnt. (the code paths are supposed to be separate though)
> > 
> > - this is how its supposed to work, and everything is allright.
> 
> No, it's a bug, and I will fix it.

OK, fixed on the emacs-24 branch with the attached patch.  You need to
do something similar with xwidget glyphs.

I also attach a test file.  Visit the file, modify the file names of
the icons to point to your repository, then eval-region on the 4
put-text-property lines.  You should see the images in the middle of
the text, both in L2R and R2L lines.  You can use this as a starting
point for doing the same with xwidgets.

Here's the patch:

diff --git a/src/xdisp.c b/src/xdisp.c
index a1cc286..b1125d3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -25428,6 +25428,15 @@ and buffer to use as the context for the formatting 
(defaults
       enum glyph_row_area area = it->area;
 
       glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
+      if (it->glyph_row->reversed_p)
+       {
+         struct glyph *g;
+
+         /* Make room for the new glyph.  */
+         for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
+           g[1] = *g;
+         glyph = it->glyph_row->glyphs[it->area];
+       }
       if (glyph < it->glyph_row->glyphs[area + 1])
        {
          glyph->charpos = CHARPOS (it->position);


And here's the test file:

============================== cut here ==============================
aaaaa  bbbbbb
 aaaaa  xxxxxx
aaaaa  yyyyyyyyy

אאאאא  בבבבב

(put-text-property 8 9 'display '(image :type xpm :file 
"/path/to/emacs/trunk/etc/images/bookmark_add.xpm"))

(put-text-property 23 24 'display '(image :type xpm :file 
"/path/to/emacs/trunk/etc/images/refresh.xpm"))

(put-text-property 37 38 'display '(image :type xpm :file 
"/path/to/emacs/trunk/etc/images/data-save.xpm"))

(put-text-property 54 55 'display '(image :type xpm :file 
"/path/to/emacs/trunk/etc/images/data-save.xpm"))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]