all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: joakim@verona.se
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] xwidget updated (1d8b8a2 -> 5f46725)
Date: Sat, 17 Jan 2015 20:39:19 +0200	[thread overview]
Message-ID: <83oapxz1yg.fsf@gnu.org> (raw)
In-Reply-To: <83r3utz3l4.fsf@gnu.org>

> Date: Sat, 17 Jan 2015 20:04:07 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
> 
> > From: joakim@verona.se
> > Cc: monnier@iro.umontreal.ca,  emacs-devel@gnu.org
> > 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"))




  parent reply	other threads:[~2015-01-17 18:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141226164113.11620.38682@vcs.savannah.gnu.org>
2014-12-27 15:22 ` [Emacs-diffs] xwidget updated (1d8b8a2 -> 5f46725) Stefan Monnier
2014-12-27 15:48   ` joakim
2014-12-28 16:08     ` Eli Zaretskii
2014-12-29  9:48       ` joakim
2014-12-29 13:46         ` Ulrich Mueller
2014-12-29 16:10           ` Eli Zaretskii
2015-01-09 20:17           ` joakim
2014-12-29 16:03         ` Eli Zaretskii
2015-01-09 20:12           ` joakim
2015-01-09 20:35             ` Eli Zaretskii
2015-01-16 20:50               ` joakim
2015-01-16 20:59                 ` Eli Zaretskii
2015-01-16 21:16                   ` joakim
2015-01-17 10:19                     ` Eli Zaretskii
2015-01-17 15:21                       ` joakim
2015-01-17 17:40                         ` joakim
2015-01-17 18:04                           ` Eli Zaretskii
2015-01-17 18:13                             ` joakim
2015-01-17 18:39                             ` Eli Zaretskii [this message]
2015-01-17 23:08                               ` joakim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83oapxz1yg.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joakim@verona.se \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.