]> code.delx.au - gnu-emacs/commitdiff
Fixed a bug with displaying strings padded with blanks.
authorEli Zaretskii <eliz@gnu.org>
Sat, 11 Jun 2011 16:50:09 +0000 (19:50 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 11 Jun 2011 16:50:09 +0000 (19:50 +0300)
 src/xdisp.c (set_iterator_to_next): Advance string position
 correctly when padding it with blanks.

src/ChangeLog
src/xdisp.c

index 3ca0241f47c038f6454e8df5a4dfda78eee89fe3..071bcb23a0311b53ba1c79f127dbfccdd9ceabaf 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-11  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (set_iterator_to_next): Advance string position
+       correctly when padding it with blanks.
+
 2011-06-11  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (next_element_from_buffer): Improve commentary for when
index efd29895ea243d52f11950970fd4e5bbd5e256fa..7494d5c5e48bf27853a379405d72f914ff7f5d9c 100644 (file)
@@ -6305,7 +6305,12 @@ set_iterator_to_next (struct it *it, int reseat_p)
 
     case GET_FROM_C_STRING:
       /* Current display element of IT is from a C string.  */
-      if (!it->bidi_p)
+      if (!it->bidi_p
+         /* If the string position is beyond string_nchars, it means
+            next_element_from_c_string is padding the string with
+            blanks, in which case we bypass the bidi iterator,
+            because it cannot deal with such virtual characters.  */
+         || IT_CHARPOS (*it) >= it->string_nchars)
        {
          IT_BYTEPOS (*it) += it->len;
          IT_CHARPOS (*it) += 1;
@@ -6428,7 +6433,13 @@ set_iterator_to_next (struct it *it, int reseat_p)
        }
       else
        {
-         if (!it->bidi_p)
+         if (!it->bidi_p
+             /* If the string position is beyond string_nchars, it
+                means next_element_from_string is padding the string
+                with blanks, in which case we bypass the bidi
+                iterator, because it cannot deal with such virtual
+                characters.  */
+             || IT_STRING_CHARPOS (*it) >= it->string_nchars)
            {
              IT_STRING_BYTEPOS (*it) += it->len;
              IT_STRING_CHARPOS (*it) += 1;