diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 12 | ||||
| -rw-r--r-- | src/dispnew.c | 16 | ||||
| -rw-r--r-- | src/xdisp.c | 29 |
3 files changed, 44 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 205ae565e6b..063d65475ef 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2010-09-22 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * xdisp.c (compute_stop_pos): Call composition_compute_stop_pos | ||
| 4 | only if we are not at a composition. | ||
| 5 | (set_iterator_to_next): Give it->end_charpos to | ||
| 6 | composition_compute_stop_pos. | ||
| 7 | (set_iterator_to_next, next_element_from_buffer): Likewise. | ||
| 8 | |||
| 9 | * dispnew.c (buffer_posn_from_coords): Fix position when the | ||
| 10 | current display element is a grapheme cluster in bidi-reordered | ||
| 11 | region. | ||
| 12 | |||
| 1 | 2010-09-21 Dan Nicolaescu <dann@ics.uci.edu> | 13 | 2010-09-21 Dan Nicolaescu <dann@ics.uci.edu> |
| 2 | 14 | ||
| 3 | * emacs.c: Do not include sys/ioctl.h, not needed. | 15 | * emacs.c: Do not include sys/ioctl.h, not needed. |
diff --git a/src/dispnew.c b/src/dispnew.c index 9344d792f3d..0869526c01d 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -5420,6 +5420,22 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5420 | if (STRINGP (it.string)) | 5420 | if (STRINGP (it.string)) |
| 5421 | string = it.string; | 5421 | string = it.string; |
| 5422 | *pos = it.current; | 5422 | *pos = it.current; |
| 5423 | if (it.what == IT_COMPOSITION | ||
| 5424 | && it.cmp_it.nchars > 1 | ||
| 5425 | && it.cmp_it.reversed_p) | ||
| 5426 | { | ||
| 5427 | /* The current display element is a grapheme cluster in a | ||
| 5428 | composition. In that case, we need the position of the first | ||
| 5429 | character of the cluster. But, as it.cmp_it.reversed_p is 1, | ||
| 5430 | it.current points to the last character of the cluster, thus | ||
| 5431 | we must move back to the first character of the same | ||
| 5432 | cluster. */ | ||
| 5433 | CHARPOS (pos->pos) -= it.cmp_it.nchars - 1; | ||
| 5434 | if (STRINGP (it.string)) | ||
| 5435 | BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos)); | ||
| 5436 | else | ||
| 5437 | BYTEPOS (pos->pos) = CHAR_TO_BYTE (CHARPOS (pos->pos)); | ||
| 5438 | } | ||
| 5423 | 5439 | ||
| 5424 | #ifdef HAVE_WINDOW_SYSTEM | 5440 | #ifdef HAVE_WINDOW_SYSTEM |
| 5425 | if (it.what == IT_IMAGE) | 5441 | if (it.what == IT_IMAGE) |
diff --git a/src/xdisp.c b/src/xdisp.c index 7b49eed4b2c..be6ff1254eb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -3177,7 +3177,7 @@ compute_stop_pos (struct it *it) | |||
| 3177 | { | 3177 | { |
| 3178 | register INTERVAL iv, next_iv; | 3178 | register INTERVAL iv, next_iv; |
| 3179 | Lisp_Object object, limit, position; | 3179 | Lisp_Object object, limit, position; |
| 3180 | EMACS_INT charpos, bytepos, stoppos; | 3180 | EMACS_INT charpos, bytepos; |
| 3181 | 3181 | ||
| 3182 | /* If nowhere else, stop at the end. */ | 3182 | /* If nowhere else, stop at the end. */ |
| 3183 | it->stop_charpos = it->end_charpos; | 3183 | it->stop_charpos = it->end_charpos; |
| @@ -3267,12 +3267,15 @@ compute_stop_pos (struct it *it) | |||
| 3267 | } | 3267 | } |
| 3268 | } | 3268 | } |
| 3269 | 3269 | ||
| 3270 | if (it->bidi_p && it->bidi_it.scan_dir < 0) | 3270 | if (it->cmp_it.id < 0) |
| 3271 | stoppos = -1; | 3271 | { |
| 3272 | else | 3272 | EMACS_INT stoppos = it->end_charpos; |
| 3273 | stoppos = it->stop_charpos; | 3273 | |
| 3274 | composition_compute_stop_pos (&it->cmp_it, charpos, bytepos, | 3274 | if (it->bidi_p && it->bidi_it.scan_dir < 0) |
| 3275 | stoppos, it->string); | 3275 | stoppos = -1; |
| 3276 | composition_compute_stop_pos (&it->cmp_it, charpos, bytepos, | ||
| 3277 | stoppos, it->string); | ||
| 3278 | } | ||
| 3276 | 3279 | ||
| 3277 | xassert (STRINGP (it->string) | 3280 | xassert (STRINGP (it->string) |
| 3278 | || (it->stop_charpos >= BEGV | 3281 | || (it->stop_charpos >= BEGV |
| @@ -6126,7 +6129,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6126 | it->cmp_it.id = -1; | 6129 | it->cmp_it.id = -1; |
| 6127 | composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), | 6130 | composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), |
| 6128 | IT_BYTEPOS (*it), | 6131 | IT_BYTEPOS (*it), |
| 6129 | it->stop_charpos, Qnil); | 6132 | it->end_charpos, Qnil); |
| 6130 | } | 6133 | } |
| 6131 | } | 6134 | } |
| 6132 | else if (! it->cmp_it.reversed_p) | 6135 | else if (! it->cmp_it.reversed_p) |
| @@ -6149,7 +6152,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6149 | { | 6152 | { |
| 6150 | /* No more grapheme clusters in this composition. | 6153 | /* No more grapheme clusters in this composition. |
| 6151 | Find the next stop position. */ | 6154 | Find the next stop position. */ |
| 6152 | EMACS_INT stop = it->stop_charpos; | 6155 | EMACS_INT stop = it->end_charpos; |
| 6153 | if (it->bidi_it.scan_dir < 0) | 6156 | if (it->bidi_it.scan_dir < 0) |
| 6154 | /* Now we are scanning backward and don't know | 6157 | /* Now we are scanning backward and don't know |
| 6155 | where to stop. */ | 6158 | where to stop. */ |
| @@ -6177,7 +6180,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6177 | { | 6180 | { |
| 6178 | /* No more grapheme clusters in this composition. | 6181 | /* No more grapheme clusters in this composition. |
| 6179 | Find the next stop position. */ | 6182 | Find the next stop position. */ |
| 6180 | EMACS_INT stop = it->stop_charpos; | 6183 | EMACS_INT stop = it->end_charpos; |
| 6181 | if (it->bidi_it.scan_dir < 0) | 6184 | if (it->bidi_it.scan_dir < 0) |
| 6182 | /* Now we are scanning backward and don't know | 6185 | /* Now we are scanning backward and don't know |
| 6183 | where to stop. */ | 6186 | where to stop. */ |
| @@ -6210,7 +6213,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6210 | { | 6213 | { |
| 6211 | /* As the scan direction was changed, we must | 6214 | /* As the scan direction was changed, we must |
| 6212 | re-compute the stop position for composition. */ | 6215 | re-compute the stop position for composition. */ |
| 6213 | EMACS_INT stop = it->stop_charpos; | 6216 | EMACS_INT stop = it->end_charpos; |
| 6214 | if (it->bidi_it.scan_dir < 0) | 6217 | if (it->bidi_it.scan_dir < 0) |
| 6215 | stop = -1; | 6218 | stop = -1; |
| 6216 | composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), | 6219 | composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), |
| @@ -6288,7 +6291,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6288 | composition_compute_stop_pos (&it->cmp_it, | 6291 | composition_compute_stop_pos (&it->cmp_it, |
| 6289 | IT_STRING_CHARPOS (*it), | 6292 | IT_STRING_CHARPOS (*it), |
| 6290 | IT_STRING_BYTEPOS (*it), | 6293 | IT_STRING_BYTEPOS (*it), |
| 6291 | it->stop_charpos, it->string); | 6294 | it->end_charpos, it->string); |
| 6292 | } | 6295 | } |
| 6293 | } | 6296 | } |
| 6294 | else | 6297 | else |
| @@ -6705,7 +6708,7 @@ next_element_from_buffer (struct it *it) | |||
| 6705 | IT_BYTEPOS (*it) = it->bidi_it.bytepos; | 6708 | IT_BYTEPOS (*it) = it->bidi_it.bytepos; |
| 6706 | SET_TEXT_POS (it->position, IT_CHARPOS (*it), IT_BYTEPOS (*it)); | 6709 | SET_TEXT_POS (it->position, IT_CHARPOS (*it), IT_BYTEPOS (*it)); |
| 6707 | { | 6710 | { |
| 6708 | EMACS_INT stop = it->stop_charpos; | 6711 | EMACS_INT stop = it->end_charpos; |
| 6709 | if (it->bidi_it.scan_dir < 0) | 6712 | if (it->bidi_it.scan_dir < 0) |
| 6710 | stop = -1; | 6713 | stop = -1; |
| 6711 | composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), | 6714 | composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), |