diff options
| author | Kenichi Handa | 2003-01-31 03:53:43 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-01-31 03:53:43 +0000 |
| commit | bc6371a658fc753f1b9872c708868b2da468f2ee (patch) | |
| tree | 8d388284b82ed6dc2249b93977e8d34247814167 /src | |
| parent | 45415a8f612519dddc749898886aee256c5e3d8c (diff) | |
| download | emacs-bc6371a658fc753f1b9872c708868b2da468f2ee.tar.gz emacs-bc6371a658fc753f1b9872c708868b2da468f2ee.zip | |
(SKIP_GLYPHS): New macro.
(set_cursor_from_row): Skip all glyphs that comes from overlay
string.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 64 |
1 files changed, 43 insertions, 21 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 851e1984cc7..edbf69dfe78 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9447,6 +9447,19 @@ redisplay_window_1 (window) | |||
| 9447 | return Qnil; | 9447 | return Qnil; |
| 9448 | } | 9448 | } |
| 9449 | 9449 | ||
| 9450 | |||
| 9451 | /* Increment GLYPH until it reaches END or CONDITION fails while | ||
| 9452 | adding (GLYPH)->pixel_width to X. */ | ||
| 9453 | |||
| 9454 | #define SKIP_GLYPHS(glyph, end, x, condition) \ | ||
| 9455 | do \ | ||
| 9456 | { \ | ||
| 9457 | (x) += (glyph)->pixel_width; \ | ||
| 9458 | ++(glyph); \ | ||
| 9459 | } \ | ||
| 9460 | while ((glyph) < (end) && (condition)) | ||
| 9461 | |||
| 9462 | |||
| 9450 | /* Set cursor position of W. PT is assumed to be displayed in ROW. | 9463 | /* Set cursor position of W. PT is assumed to be displayed in ROW. |
| 9451 | DELTA is the number of bytes by which positions recorded in ROW | 9464 | DELTA is the number of bytes by which positions recorded in ROW |
| 9452 | differ from current buffer positions. */ | 9465 | differ from current buffer positions. */ |
| @@ -9501,12 +9514,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 9501 | string_start = glyph; | 9514 | string_start = glyph; |
| 9502 | string_start_x = x; | 9515 | string_start_x = x; |
| 9503 | /* Skip all glyphs from string. */ | 9516 | /* Skip all glyphs from string. */ |
| 9504 | do | 9517 | SKIP_GLYPHS (glyph, end, x, STRINGP (glyph->object)); |
| 9505 | { | ||
| 9506 | x += glyph->pixel_width; | ||
| 9507 | ++glyph; | ||
| 9508 | } | ||
| 9509 | while (glyph < end && STRINGP (glyph->object)); | ||
| 9510 | } | 9518 | } |
| 9511 | } | 9519 | } |
| 9512 | 9520 | ||
| @@ -9517,28 +9525,42 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 9517 | are from string. As there's no easy way to know the | 9525 | are from string. As there's no easy way to know the |
| 9518 | character position of the current glyph, find the correct | 9526 | character position of the current glyph, find the correct |
| 9519 | glyph on point by scanning from string_start again. */ | 9527 | glyph on point by scanning from string_start again. */ |
| 9520 | Lisp_Object pos, limit; | 9528 | Lisp_Object limit; |
| 9529 | Lisp_Object string; | ||
| 9530 | int pos; | ||
| 9521 | 9531 | ||
| 9522 | limit = make_number (MATRIX_ROW_END_CHARPOS (row) + delta); | 9532 | limit = make_number (pt_old + 1); |
| 9533 | end = glyph; | ||
| 9523 | glyph = string_start; | 9534 | glyph = string_start; |
| 9524 | x = string_start_x; | 9535 | x = string_start_x; |
| 9525 | pos = make_number (string_buffer_position (w, glyph->object, | 9536 | string = glyph->object; |
| 9526 | string_before_pos)); | 9537 | pos = string_buffer_position (w, string, string_before_pos); |
| 9527 | pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil, limit); | 9538 | /* If STRING is from overlay, LAST_POS == 0. We skip such glyphs |
| 9528 | while (XINT (pos) <= pt_old) | 9539 | because we always put cursor after overlay strings. */ |
| 9540 | while (pos == 0 && glyph < end) | ||
| 9529 | { | 9541 | { |
| 9542 | string = glyph->object; | ||
| 9543 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); | ||
| 9544 | if (glyph < end) | ||
| 9545 | pos = string_buffer_position (w, glyph->object, string_before_pos); | ||
| 9546 | } | ||
| 9547 | |||
| 9548 | while (glyph < end) | ||
| 9549 | { | ||
| 9550 | pos = XINT (Fnext_single_char_property_change | ||
| 9551 | (make_number (pos), Qdisplay, Qnil, limit)); | ||
| 9552 | if (pos > pt_old) | ||
| 9553 | break; | ||
| 9530 | /* Skip glyphs from the same string. */ | 9554 | /* Skip glyphs from the same string. */ |
| 9531 | do | 9555 | string = glyph->object; |
| 9556 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); | ||
| 9557 | /* Skip glyphs from an overlay. */ | ||
| 9558 | while (glyph < end | ||
| 9559 | && ! string_buffer_position (w, glyph->object, pos)) | ||
| 9532 | { | 9560 | { |
| 9533 | x += glyph->pixel_width; | 9561 | string = glyph->object; |
| 9534 | ++glyph; | 9562 | SKIP_GLYPHS (glyph, end, x, EQ (glyph->object, string)); |
| 9535 | } | 9563 | } |
| 9536 | while (glyph < end | ||
| 9537 | && EQ (glyph->object, string_start->object)); | ||
| 9538 | if (glyph == end || !STRINGP (glyph->object)) | ||
| 9539 | break; | ||
| 9540 | string_start = glyph; | ||
| 9541 | pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil, limit); | ||
| 9542 | } | 9564 | } |
| 9543 | } | 9565 | } |
| 9544 | 9566 | ||