diff options
| author | Joakim Verona | 2011-08-02 11:42:58 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-08-02 11:42:58 +0200 |
| commit | c040cbd945a3fde6324c73563dc2d11629ad3081 (patch) | |
| tree | 88cb76e2533cb211b0df151a31fab8e6ad24371e /src | |
| parent | e31c3c3f9c2118bf73f32a9573fefd01c9966bc2 (diff) | |
| parent | d90e2ea0eeccb7422fc7c8ab727a61c49c135e03 (diff) | |
| download | emacs-c040cbd945a3fde6324c73563dc2d11629ad3081.tar.gz emacs-c040cbd945a3fde6324c73563dc2d11629ad3081.zip | |
merge upstream + stray par fix
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/xdisp.c | 44 |
2 files changed, 41 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 623ccc6f4be..4e8217cdf5f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2011-08-01 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (forward_to_next_line_start): Accept additional argument | ||
| 4 | BIDI_IT_PREV, and store into it the state of the bidi iterator had | ||
| 5 | on the newline. | ||
| 6 | (reseat_at_next_visible_line_start): Use the bidi iterator state | ||
| 7 | returned by forward_to_next_line_start to restore the state of | ||
| 8 | it->bidi_it after backing up to previous newline. (Bug#9212) | ||
| 9 | |||
| 1 | 2011-07-30 Andreas Schwab <schwab@linux-m68k.org> | 10 | 2011-07-30 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 11 | ||
| 3 | * regex.c (re_comp): Protoize. | 12 | * regex.c (re_comp): Protoize. |
diff --git a/src/xdisp.c b/src/xdisp.c index 14541eb9df0..22d353b840b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -904,7 +904,7 @@ static void init_to_row_start (struct it *, struct window *, | |||
| 904 | static int init_to_row_end (struct it *, struct window *, | 904 | static int init_to_row_end (struct it *, struct window *, |
| 905 | struct glyph_row *); | 905 | struct glyph_row *); |
| 906 | static void back_to_previous_line_start (struct it *); | 906 | static void back_to_previous_line_start (struct it *); |
| 907 | static int forward_to_next_line_start (struct it *, int *); | 907 | static int forward_to_next_line_start (struct it *, int *, struct bidi_it *); |
| 908 | static struct text_pos string_pos_nchars_ahead (struct text_pos, | 908 | static struct text_pos string_pos_nchars_ahead (struct text_pos, |
| 909 | Lisp_Object, EMACS_INT); | 909 | Lisp_Object, EMACS_INT); |
| 910 | static struct text_pos string_pos (EMACS_INT, Lisp_Object); | 910 | static struct text_pos string_pos (EMACS_INT, Lisp_Object); |
| @@ -5529,6 +5529,9 @@ back_to_previous_line_start (struct it *it) | |||
| 5529 | continuously over the text). Otherwise, don't change the value | 5529 | continuously over the text). Otherwise, don't change the value |
| 5530 | of *SKIPPED_P. | 5530 | of *SKIPPED_P. |
| 5531 | 5531 | ||
| 5532 | If BIDI_IT_PREV is non-NULL, store into it the state of the bidi | ||
| 5533 | iterator on the newline, if it was found. | ||
| 5534 | |||
| 5532 | Newlines may come from buffer text, overlay strings, or strings | 5535 | Newlines may come from buffer text, overlay strings, or strings |
| 5533 | displayed via the `display' property. That's the reason we can't | 5536 | displayed via the `display' property. That's the reason we can't |
| 5534 | simply use find_next_newline_no_quit. | 5537 | simply use find_next_newline_no_quit. |
| @@ -5541,7 +5544,8 @@ back_to_previous_line_start (struct it *it) | |||
| 5541 | leads to wrong cursor motion. */ | 5544 | leads to wrong cursor motion. */ |
| 5542 | 5545 | ||
| 5543 | static int | 5546 | static int |
| 5544 | forward_to_next_line_start (struct it *it, int *skipped_p) | 5547 | forward_to_next_line_start (struct it *it, int *skipped_p, |
| 5548 | struct bidi_it *bidi_it_prev) | ||
| 5545 | { | 5549 | { |
| 5546 | EMACS_INT old_selective; | 5550 | EMACS_INT old_selective; |
| 5547 | int newline_found_p, n; | 5551 | int newline_found_p, n; |
| @@ -5553,6 +5557,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p) | |||
| 5553 | && it->c == '\n' | 5557 | && it->c == '\n' |
| 5554 | && CHARPOS (it->position) == IT_CHARPOS (*it)) | 5558 | && CHARPOS (it->position) == IT_CHARPOS (*it)) |
| 5555 | { | 5559 | { |
| 5560 | if (it->bidi_p && bidi_it_prev) | ||
| 5561 | *bidi_it_prev = it->bidi_it; | ||
| 5556 | set_iterator_to_next (it, 0); | 5562 | set_iterator_to_next (it, 0); |
| 5557 | it->c = 0; | 5563 | it->c = 0; |
| 5558 | return 1; | 5564 | return 1; |
| @@ -5574,6 +5580,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p) | |||
| 5574 | if (!get_next_display_element (it)) | 5580 | if (!get_next_display_element (it)) |
| 5575 | return 0; | 5581 | return 0; |
| 5576 | newline_found_p = it->what == IT_CHARACTER && it->c == '\n'; | 5582 | newline_found_p = it->what == IT_CHARACTER && it->c == '\n'; |
| 5583 | if (newline_found_p && it->bidi_p && bidi_it_prev) | ||
| 5584 | *bidi_it_prev = it->bidi_it; | ||
| 5577 | set_iterator_to_next (it, 0); | 5585 | set_iterator_to_next (it, 0); |
| 5578 | } | 5586 | } |
| 5579 | 5587 | ||
| @@ -5608,6 +5616,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p) | |||
| 5608 | && !newline_found_p) | 5616 | && !newline_found_p) |
| 5609 | { | 5617 | { |
| 5610 | newline_found_p = ITERATOR_AT_END_OF_LINE_P (it); | 5618 | newline_found_p = ITERATOR_AT_END_OF_LINE_P (it); |
| 5619 | if (newline_found_p && it->bidi_p && bidi_it_prev) | ||
| 5620 | *bidi_it_prev = it->bidi_it; | ||
| 5611 | set_iterator_to_next (it, 0); | 5621 | set_iterator_to_next (it, 0); |
| 5612 | } | 5622 | } |
| 5613 | } | 5623 | } |
| @@ -5731,8 +5741,9 @@ static void | |||
| 5731 | reseat_at_next_visible_line_start (struct it *it, int on_newline_p) | 5741 | reseat_at_next_visible_line_start (struct it *it, int on_newline_p) |
| 5732 | { | 5742 | { |
| 5733 | int newline_found_p, skipped_p = 0; | 5743 | int newline_found_p, skipped_p = 0; |
| 5744 | struct bidi_it bidi_it_prev; | ||
| 5734 | 5745 | ||
| 5735 | newline_found_p = forward_to_next_line_start (it, &skipped_p); | 5746 | newline_found_p = forward_to_next_line_start (it, &skipped_p, &bidi_it_prev); |
| 5736 | 5747 | ||
| 5737 | /* Skip over lines that are invisible because they are indented | 5748 | /* Skip over lines that are invisible because they are indented |
| 5738 | more than the value of IT->selective. */ | 5749 | more than the value of IT->selective. */ |
| @@ -5743,7 +5754,8 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p) | |||
| 5743 | { | 5754 | { |
| 5744 | xassert (IT_BYTEPOS (*it) == BEGV | 5755 | xassert (IT_BYTEPOS (*it) == BEGV |
| 5745 | || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); | 5756 | || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n'); |
| 5746 | newline_found_p = forward_to_next_line_start (it, &skipped_p); | 5757 | newline_found_p = |
| 5758 | forward_to_next_line_start (it, &skipped_p, &bidi_it_prev); | ||
| 5747 | } | 5759 | } |
| 5748 | 5760 | ||
| 5749 | /* Position on the newline if that's what's requested. */ | 5761 | /* Position on the newline if that's what's requested. */ |
| @@ -5759,11 +5771,14 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p) | |||
| 5759 | --IT_STRING_BYTEPOS (*it); | 5771 | --IT_STRING_BYTEPOS (*it); |
| 5760 | } | 5772 | } |
| 5761 | else | 5773 | else |
| 5762 | /* Setting this flag will cause | 5774 | { |
| 5763 | bidi_move_to_visually_next not to advance, but | 5775 | /* We need to restore the bidi iterator to the state |
| 5764 | instead deliver the current character (newline), | 5776 | it had on the newline, and resync the IT's |
| 5765 | which is what the ON_NEWLINE_P flag wants. */ | 5777 | position with that. */ |
| 5766 | it->bidi_it.first_elt = 1; | 5778 | it->bidi_it = bidi_it_prev; |
| 5779 | IT_STRING_CHARPOS (*it) = it->bidi_it.charpos; | ||
| 5780 | IT_STRING_BYTEPOS (*it) = it->bidi_it.bytepos; | ||
| 5781 | } | ||
| 5767 | } | 5782 | } |
| 5768 | } | 5783 | } |
| 5769 | else if (IT_CHARPOS (*it) > BEGV) | 5784 | else if (IT_CHARPOS (*it) > BEGV) |
| @@ -5773,9 +5788,14 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p) | |||
| 5773 | --IT_CHARPOS (*it); | 5788 | --IT_CHARPOS (*it); |
| 5774 | --IT_BYTEPOS (*it); | 5789 | --IT_BYTEPOS (*it); |
| 5775 | } | 5790 | } |
| 5776 | /* With bidi iteration, the call to `reseat' will cause | 5791 | else |
| 5777 | bidi_move_to_visually_next deliver the current character, | 5792 | { |
| 5778 | the newline, instead of advancing. */ | 5793 | /* We need to restore the bidi iterator to the state it |
| 5794 | had on the newline and resync IT with that. */ | ||
| 5795 | it->bidi_it = bidi_it_prev; | ||
| 5796 | IT_CHARPOS (*it) = it->bidi_it.charpos; | ||
| 5797 | IT_BYTEPOS (*it) = it->bidi_it.bytepos; | ||
| 5798 | } | ||
| 5779 | reseat (it, it->current.pos, 0); | 5799 | reseat (it, it->current.pos, 0); |
| 5780 | } | 5800 | } |
| 5781 | } | 5801 | } |