From: Eli Zaretskii Date: Sat, 11 Jun 2011 16:50:09 +0000 (+0300) Subject: Fixed a bug with displaying strings padded with blanks. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~25 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f23590ccc9bb0b6d335fb098b56ea07f4de6c91c;p=emacs.git Fixed a bug with displaying strings padded with blanks. src/xdisp.c (set_iterator_to_next): Advance string position correctly when padding it with blanks. --- diff --git a/src/ChangeLog b/src/ChangeLog index 3ca0241f47c..071bcb23a03 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-06-11 Eli Zaretskii + + * xdisp.c (set_iterator_to_next): Advance string position + correctly when padding it with blanks. + 2011-06-11 Eli Zaretskii * xdisp.c (next_element_from_buffer): Improve commentary for when diff --git a/src/xdisp.c b/src/xdisp.c index efd29895ea2..7494d5c5e48 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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;