diff options
| author | Eli Zaretskii | 2010-03-20 10:32:32 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2010-03-20 10:32:32 -0400 |
| commit | 34689d3c1ad54fd463d5f20c64bb1ac655dc5741 (patch) | |
| tree | 15dc39ad25cdcbaa75927b478136c9e2733a4470 /src | |
| parent | f2cdb04ac04fb8f9f92bce11df6e4a020720208b (diff) | |
| download | emacs-34689d3c1ad54fd463d5f20c64bb1ac655dc5741.tar.gz emacs-34689d3c1ad54fd463d5f20c64bb1ac655dc5741.zip | |
Finish work on cursor motion in continuation lines.
xdisp.c (set_cursor_from_row): Don't miss a candidate row whose
glyph->charpos is an exact match for point.
(try_cursor_movement): Don't give up if rows are bidi-reordered
and point moved backwards. Instead, back up to the row that is
not a continuation line.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog.bidi | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 60 |
2 files changed, 53 insertions, 15 deletions
diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi index 8f96779196d..9e0236fcefb 100644 --- a/src/ChangeLog.bidi +++ b/src/ChangeLog.bidi | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2010-03-20 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (set_cursor_from_row): Don't miss a candidate row whose | ||
| 4 | glyph->charpos is an exact match for point. | ||
| 5 | (try_cursor_movement): Don't give up if rows are bidi-reordered | ||
| 6 | and point moved backwards. Instead, back up to the row that is | ||
| 7 | not a continuation line. | ||
| 8 | |||
| 1 | 2010-03-13 Eli Zaretskii <eliz@gnu.org> | 9 | 2010-03-13 Eli Zaretskii <eliz@gnu.org> |
| 2 | 10 | ||
| 3 | * xdisp.c (try_cursor_movement): Give up if rows are | 11 | * xdisp.c (try_cursor_movement): Give up if rows are |
diff --git a/src/xdisp.c b/src/xdisp.c index 7fcb5243162..f2e06c0a2e7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -13036,13 +13036,16 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 13036 | && eabs (g1->charpos - pt_old) | 13036 | && eabs (g1->charpos - pt_old) |
| 13037 | < eabs (glyph->charpos - pt_old)))) | 13037 | < eabs (glyph->charpos - pt_old)))) |
| 13038 | return 0; | 13038 | return 0; |
| 13039 | /* Keep the candidate that comes from a row spanning less buffer | 13039 | /* If this candidate gives an exact match, use that. */ |
| 13040 | positions. This may win when one or both candidate positions | 13040 | if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old) |
| 13041 | are on glyphs that came from display strings, for which we | 13041 | /* Otherwise, keep the candidate that comes from a row |
| 13042 | cannot compare buffer positions. */ | 13042 | spanning less buffer positions. This may win when one or |
| 13043 | if (MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) | 13043 | both candidate positions are on glyphs that came from |
| 13044 | - MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) | 13044 | display strings, for which we cannot compare buffer |
| 13045 | < MATRIX_ROW_END_CHARPOS (row) - MATRIX_ROW_START_CHARPOS (row)) | 13045 | positions. */ |
| 13046 | && MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) | ||
| 13047 | - MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) | ||
| 13048 | < MATRIX_ROW_END_CHARPOS (row) - MATRIX_ROW_START_CHARPOS (row)) | ||
| 13046 | return 0; | 13049 | return 0; |
| 13047 | } | 13050 | } |
| 13048 | w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; | 13051 | w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; |
| @@ -13541,12 +13544,6 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 13541 | && NILP (Vshow_trailing_whitespace) | 13544 | && NILP (Vshow_trailing_whitespace) |
| 13542 | /* Right after splitting windows, last_point may be nil. */ | 13545 | /* Right after splitting windows, last_point may be nil. */ |
| 13543 | && INTEGERP (w->last_point) | 13546 | && INTEGERP (w->last_point) |
| 13544 | /* Can't use this optimization if rows were bidi-reordered and | ||
| 13545 | point moved backwards, because that would mean we would need | ||
| 13546 | to examine previous rows that came from the same continued | ||
| 13547 | line. */ | ||
| 13548 | && (PT > XFASTINT (w->last_point) | ||
| 13549 | || NILP (XBUFFER (w->buffer)->bidi_display_reordering)) | ||
| 13550 | /* This code is not used for mini-buffer for the sake of the case | 13547 | /* This code is not used for mini-buffer for the sake of the case |
| 13551 | of redisplaying to replace an echo area message; since in | 13548 | of redisplaying to replace an echo area message; since in |
| 13552 | that case the mini-buffer contents per se are usually | 13549 | that case the mini-buffer contents per se are usually |
| @@ -13597,6 +13594,32 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 13597 | ++row; | 13594 | ++row; |
| 13598 | if (!row->enabled_p) | 13595 | if (!row->enabled_p) |
| 13599 | rc = CURSOR_MOVEMENT_MUST_SCROLL; | 13596 | rc = CURSOR_MOVEMENT_MUST_SCROLL; |
| 13597 | /* If rows are bidi-reordered, back up until we find a row | ||
| 13598 | that does not belong to a continuation line. This is | ||
| 13599 | because we must consider all rows of a continued line as | ||
| 13600 | candidates for cursor positioning, since row start and | ||
| 13601 | end positions change non-linearly with vertical position | ||
| 13602 | in such rows. */ | ||
| 13603 | /* FIXME: Revisit this when glyph ``spilling'' in | ||
| 13604 | continuation lines' rows is implemented for | ||
| 13605 | bidi-reordered rows. */ | ||
| 13606 | if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering)) | ||
| 13607 | { | ||
| 13608 | while (MATRIX_ROW_CONTINUATION_LINE_P (row)) | ||
| 13609 | { | ||
| 13610 | xassert (row->enabled_p); | ||
| 13611 | --row; | ||
| 13612 | /* If we hit the beginning of the displayed portion | ||
| 13613 | without finding the first row of a continued | ||
| 13614 | line, give up. */ | ||
| 13615 | if (row <= w->current_matrix->rows) | ||
| 13616 | { | ||
| 13617 | rc = CURSOR_MOVEMENT_MUST_SCROLL; | ||
| 13618 | break; | ||
| 13619 | } | ||
| 13620 | |||
| 13621 | } | ||
| 13622 | } | ||
| 13600 | } | 13623 | } |
| 13601 | 13624 | ||
| 13602 | if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED) | 13625 | if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED) |
| @@ -13724,8 +13747,11 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 13724 | { | 13747 | { |
| 13725 | /* With bidi-reordered rows, there could be more than | 13748 | /* With bidi-reordered rows, there could be more than |
| 13726 | one candidate row whose start and end positions | 13749 | one candidate row whose start and end positions |
| 13727 | occlude point. We need to find the best | 13750 | occlude point. We need to let set_cursor_from_row |
| 13728 | candidate. */ | 13751 | find the best candidate. */ |
| 13752 | /* FIXME: Revisit this when glyph ``spilling'' in | ||
| 13753 | continuation lines' rows is implemented for | ||
| 13754 | bidi-reordered rows. */ | ||
| 13729 | int rv = 0; | 13755 | int rv = 0; |
| 13730 | 13756 | ||
| 13731 | do | 13757 | do |
| @@ -17680,6 +17706,8 @@ display_line (it) | |||
| 17680 | buffer positions in ROW. But if ROW was bidi-reordered, | 17706 | buffer positions in ROW. But if ROW was bidi-reordered, |
| 17681 | these two positions can be anywhere in the row, so we must | 17707 | these two positions can be anywhere in the row, so we must |
| 17682 | rescan all of the ROW's glyphs to find them. */ | 17708 | rescan all of the ROW's glyphs to find them. */ |
| 17709 | /* FIXME: Revisit this when glyph ``spilling'' in continuation | ||
| 17710 | lines' rows is implemented for bidi-reordered rows. */ | ||
| 17683 | EMACS_INT min_pos = ZV + 1, max_pos = 0; | 17711 | EMACS_INT min_pos = ZV + 1, max_pos = 0; |
| 17684 | struct glyph *g; | 17712 | struct glyph *g; |
| 17685 | struct it save_it; | 17713 | struct it save_it; |
| @@ -17807,6 +17835,8 @@ display_line (it) | |||
| 17807 | when a line is continued. One exception: when we are at ZV, | 17835 | when a line is continued. One exception: when we are at ZV, |
| 17808 | display cursor on the first suitable glyph row, since all | 17836 | display cursor on the first suitable glyph row, since all |
| 17809 | the empty rows after that also have their position set to ZV. */ | 17837 | the empty rows after that also have their position set to ZV. */ |
| 17838 | /* FIXME: Revisit this when glyph ``spilling'' in continuation | ||
| 17839 | lines' rows is implemented for bidi-reordered rows. */ | ||
| 17810 | || (it->bidi_p | 17840 | || (it->bidi_p |
| 17811 | && !MATRIX_ROW (it->w->desired_matrix, cvpos)->ends_at_zv_p)) | 17841 | && !MATRIX_ROW (it->w->desired_matrix, cvpos)->ends_at_zv_p)) |
| 17812 | && PT >= MATRIX_ROW_START_CHARPOS (row) | 17842 | && PT >= MATRIX_ROW_START_CHARPOS (row) |