[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110767: Fix bidi initialization i
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r110767: Fix bidi initialization in init_from_display_pos. |
Date: |
Sat, 03 Nov 2012 11:25:34 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 110767
fixes bug: http://debbugs.gnu.org/12745
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Sat 2012-11-03 11:25:34 +0200
message:
Fix bidi initialization in init_from_display_pos.
src/xdisp.c (init_from_display_pos): Fix initialization of the bidi
iterator when starting in the middle of a display or overlay
string.
modified:
src/ChangeLog
src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-11-01 14:21:45 +0000
+++ b/src/ChangeLog 2012-11-03 09:25:34 +0000
@@ -1,3 +1,9 @@
+2012-11-03 Eli Zaretskii <address@hidden>
+
+ * xdisp.c (init_from_display_pos): Fix initialization of the bidi
+ iterator when starting in the middle of a display or overlay
+ string. (Bug#12745)
+
2012-11-01 Eli Zaretskii <address@hidden>
* w32proc.c (getpgrp, setpgid): New functions. (Bug#12776)
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2012-10-20 21:30:51 +0000
+++ b/src/xdisp.c 2012-11-03 09:25:34 +0000
@@ -928,6 +928,7 @@
move_it_in_display_line_to (struct it *, ptrdiff_t, int,
enum move_operation_enum);
void move_it_vertically_backward (struct it *, int);
+static void get_visually_first_element (struct it *);
static void init_to_row_start (struct it *, struct window *,
struct glyph_row *);
static int init_to_row_end (struct it *, struct window *,
@@ -3113,6 +3114,40 @@
eassert (STRINGP (it->string));
it->current.string_pos = pos->string_pos;
it->method = GET_FROM_STRING;
+ it->end_charpos = SCHARS (it->string);
+ /* Set up the bidi iterator for this overlay string. */
+ if (it->bidi_p)
+ {
+ it->bidi_it.string.lstring = it->string;
+ it->bidi_it.string.s = NULL;
+ it->bidi_it.string.schars = SCHARS (it->string);
+ it->bidi_it.string.bufpos = it->overlay_strings_charpos;
+ it->bidi_it.string.from_disp_str = it->string_from_display_prop_p;
+ it->bidi_it.string.unibyte = !it->multibyte_p;
+ bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it),
+ FRAME_WINDOW_P (it->f), &it->bidi_it);
+
+ /* Synchronize the state of the bidi iterator with
+ pos->string_pos. For any string position other than
+ zero, this will be done automagically when we resume
+ iteration over the string and get_visually_first_element
+ is called. But if string_pos is zero, and the string is
+ to be reordered for display, we need to resync manually,
+ since it could be that the iteration state recorded in
+ pos ended at string_pos of 0 moving backwards in string. */
+ if (CHARPOS (pos->string_pos) == 0)
+ {
+ get_visually_first_element (it);
+ if (IT_STRING_CHARPOS (*it) != 0)
+ do {
+ /* Paranoia. */
+ eassert (it->bidi_it.charpos < it->bidi_it.string.schars);
+ bidi_move_to_visually_next (&it->bidi_it);
+ } while (it->bidi_it.charpos != 0);
+ }
+ eassert (IT_STRING_CHARPOS (*it) == it->bidi_it.charpos
+ && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos);
+ }
}
if (CHARPOS (pos->string_pos) >= 0)
@@ -3122,6 +3157,9 @@
IT should already be filled with that string. */
it->current.string_pos = pos->string_pos;
eassert (STRINGP (it->string));
+ if (it->bidi_p)
+ bidi_init_it (IT_STRING_CHARPOS (*it), IT_STRING_BYTEPOS (*it),
+ FRAME_WINDOW_P (it->f), &it->bidi_it);
}
/* Restore position in display vector translations, control
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r110767: Fix bidi initialization in init_from_display_pos.,
Eli Zaretskii <=