diff options
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 29 |
2 files changed, 33 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7eb18593993..8f77f6a4fd9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2011-08-27 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (move_it_to): Don't bail out early when reaching | ||
| 4 | position beyond to_charpos, if we are scanning backwards. | ||
| 5 | (move_it_vertically_backward): When DY == 0, make sure we get to | ||
| 6 | the first character in the line after the newline. | ||
| 7 | |||
| 1 | 2011-08-27 Paul Eggert <eggert@cs.ucla.edu> | 8 | 2011-08-27 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 9 | ||
| 3 | * ccl.c: Improve and simplify overflow checking (Bug#9196). | 10 | * ccl.c: Improve and simplify overflow checking (Bug#9196). |
diff --git a/src/xdisp.c b/src/xdisp.c index b60e3b466a8..2afc8fc9af1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -8360,7 +8360,14 @@ move_it_to (struct it *it, EMACS_INT to_charpos, int to_x, int to_y, int to_vpos | |||
| 8360 | else if (BUFFERP (it->object) | 8360 | else if (BUFFERP (it->object) |
| 8361 | && (it->method == GET_FROM_BUFFER | 8361 | && (it->method == GET_FROM_BUFFER |
| 8362 | || it->method == GET_FROM_STRETCH) | 8362 | || it->method == GET_FROM_STRETCH) |
| 8363 | && IT_CHARPOS (*it) >= to_charpos) | 8363 | && IT_CHARPOS (*it) >= to_charpos |
| 8364 | /* Under bidi iteration, a call to set_iterator_to_next | ||
| 8365 | can scan far beyond to_charpos if the initial | ||
| 8366 | portion of the next line needs to be reordered. In | ||
| 8367 | that case, give move_it_in_display_line_to another | ||
| 8368 | chance below. */ | ||
| 8369 | && !(it->bidi_p | ||
| 8370 | && it->bidi_it.scan_dir == -1)) | ||
| 8364 | skip = MOVE_POS_MATCH_OR_ZV; | 8371 | skip = MOVE_POS_MATCH_OR_ZV; |
| 8365 | else | 8372 | else |
| 8366 | skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS); | 8373 | skip = move_it_in_display_line_to (it, to_charpos, -1, MOVE_TO_POS); |
| @@ -8495,7 +8502,8 @@ move_it_vertically_backward (struct it *it, int dy) | |||
| 8495 | reseat_1 (it, it->current.pos, 1); | 8502 | reseat_1 (it, it->current.pos, 1); |
| 8496 | 8503 | ||
| 8497 | /* We are now surely at a line start. */ | 8504 | /* We are now surely at a line start. */ |
| 8498 | it->current_x = it->hpos = 0; | 8505 | it->current_x = it->hpos = 0; /* FIXME: this is incorrect when bidi |
| 8506 | reordering is in effect. */ | ||
| 8499 | it->continuation_lines_width = 0; | 8507 | it->continuation_lines_width = 0; |
| 8500 | 8508 | ||
| 8501 | /* Move forward and see what y-distance we moved. First move to the | 8509 | /* Move forward and see what y-distance we moved. First move to the |
| @@ -8529,10 +8537,25 @@ move_it_vertically_backward (struct it *it, int dy) | |||
| 8529 | if (dy == 0) | 8537 | if (dy == 0) |
| 8530 | { | 8538 | { |
| 8531 | /* DY == 0 means move to the start of the screen line. The | 8539 | /* DY == 0 means move to the start of the screen line. The |
| 8532 | value of nlines is > 0 if continuation lines were involved. */ | 8540 | value of nlines is > 0 if continuation lines were involved, |
| 8541 | or if the original IT position was at start of a line. */ | ||
| 8533 | RESTORE_IT (it, it, it2data); | 8542 | RESTORE_IT (it, it, it2data); |
| 8534 | if (nlines > 0) | 8543 | if (nlines > 0) |
| 8535 | move_it_by_lines (it, nlines); | 8544 | move_it_by_lines (it, nlines); |
| 8545 | /* The above code moves us to some position NLINES down, | ||
| 8546 | usually to its first glyph (leftmost in an L2R line), but | ||
| 8547 | that's not necessarily the start of the line, under bidi | ||
| 8548 | reordering. We want to get to the character position | ||
| 8549 | that is immediately after the newline of the previous | ||
| 8550 | line. */ | ||
| 8551 | if (it->bidi_p && IT_CHARPOS (*it) > BEGV | ||
| 8552 | && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n') | ||
| 8553 | { | ||
| 8554 | EMACS_INT nl_pos = | ||
| 8555 | find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1); | ||
| 8556 | |||
| 8557 | move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS); | ||
| 8558 | } | ||
| 8536 | bidi_unshelve_cache (it3data, 1); | 8559 | bidi_unshelve_cache (it3data, 1); |
| 8537 | } | 8560 | } |
| 8538 | else | 8561 | else |