diff options
| author | Eli Zaretskii | 2010-04-17 13:29:40 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2010-04-17 13:29:40 +0300 |
| commit | 459035295cb9de3fcd37af915200f766031f1540 (patch) | |
| tree | 34a0d3fa09da7a320526e90b640fb49778f1b6dc /src | |
| parent | 8fccb1179b7e25ddd8f6b0ed74fadc7bb4940a3c (diff) | |
| download | emacs-459035295cb9de3fcd37af915200f766031f1540.tar.gz emacs-459035295cb9de3fcd37af915200f766031f1540.zip | |
Fix two crashes with display of R2L lines in GUI sessions.
xdisp.c (next_element_from_buffer): Don't call
bidi_paragraph_init if we are at ZV. Fixes a crash when reseated to
ZV by try_window_reusing_current_matrix.
(display_and_set_cursor, erase_phys_cursor): Handle negative HPOS,
which happens with R2L glyph rows. Fixes a crash when inserting a
character at end of an R2L line.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 17 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9625a1e8832..3d5ba045168 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2010-04-17 Eli Zaretskii <eliz@gnu.org> | 1 | 2010-04-17 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * xdisp.c (next_element_from_buffer): Don't call | ||
| 4 | bidi_paragraph_init if we are at ZV. Fixes a crash when reseated to | ||
| 5 | ZV by try_window_reusing_current_matrix. | ||
| 6 | (display_and_set_cursor, erase_phys_cursor): Handle negative HPOS, | ||
| 7 | which happens with R2L glyph rows. Fixes a crash when inserting a | ||
| 8 | character at end of an R2L line. | ||
| 9 | |||
| 3 | Continue work on R2L paragraphs in GUI sessions. | 10 | Continue work on R2L paragraphs in GUI sessions. |
| 4 | 11 | ||
| 5 | * xdisp.c (set_cursor_from_row): Don't be fooled by truncated | 12 | * xdisp.c (set_cursor_from_row): Don't be fooled by truncated |
diff --git a/src/xdisp.c b/src/xdisp.c index f564ee6265a..b278538f625 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -6635,13 +6635,20 @@ next_element_from_buffer (it) | |||
| 6635 | { | 6635 | { |
| 6636 | it->bidi_it.charpos = IT_CHARPOS (*it); | 6636 | it->bidi_it.charpos = IT_CHARPOS (*it); |
| 6637 | it->bidi_it.bytepos = IT_BYTEPOS (*it); | 6637 | it->bidi_it.bytepos = IT_BYTEPOS (*it); |
| 6638 | /* If we are at the beginning of a line, we can produce the next | 6638 | if (it->bidi_it.bytepos == ZV_BYTE) |
| 6639 | element right away. */ | 6639 | { |
| 6640 | if (it->bidi_it.bytepos == BEGV_BYTE | 6640 | /* Nothing to do, but reset the FIRST_ELT flag, like |
| 6641 | bidi_paragraph_init does, because we are not going to | ||
| 6642 | call it. */ | ||
| 6643 | it->bidi_it.first_elt = 0; | ||
| 6644 | } | ||
| 6645 | else if (it->bidi_it.bytepos == BEGV_BYTE | ||
| 6641 | /* FIXME: Should support all Unicode line separators. */ | 6646 | /* FIXME: Should support all Unicode line separators. */ |
| 6642 | || FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n' | 6647 | || FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n' |
| 6643 | || FETCH_CHAR (it->bidi_it.bytepos) == '\n') | 6648 | || FETCH_CHAR (it->bidi_it.bytepos) == '\n') |
| 6644 | { | 6649 | { |
| 6650 | /* If we are at the beginning of a line, we can produce the | ||
| 6651 | next element right away. */ | ||
| 6645 | bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); | 6652 | bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it); |
| 6646 | bidi_get_next_char_visually (&it->bidi_it); | 6653 | bidi_get_next_char_visually (&it->bidi_it); |
| 6647 | } | 6654 | } |
| @@ -23448,7 +23455,7 @@ erase_phys_cursor (w) | |||
| 23448 | /* Don't redraw the cursor's spot in mouse face if it is at the | 23455 | /* Don't redraw the cursor's spot in mouse face if it is at the |
| 23449 | end of a line (on a newline). The cursor appears there, but | 23456 | end of a line (on a newline). The cursor appears there, but |
| 23450 | mouse highlighting does not. */ | 23457 | mouse highlighting does not. */ |
| 23451 | && cursor_row->used[TEXT_AREA] > hpos) | 23458 | && cursor_row->used[TEXT_AREA] > hpos && hpos >= 0) |
| 23452 | mouse_face_here_p = 1; | 23459 | mouse_face_here_p = 1; |
| 23453 | 23460 | ||
| 23454 | /* Maybe clear the display under the cursor. */ | 23461 | /* Maybe clear the display under the cursor. */ |
| @@ -23530,7 +23537,7 @@ display_and_set_cursor (w, on, hpos, vpos, x, y) | |||
| 23530 | 23537 | ||
| 23531 | glyph = NULL; | 23538 | glyph = NULL; |
| 23532 | if (!glyph_row->exact_window_width_line_p | 23539 | if (!glyph_row->exact_window_width_line_p |
| 23533 | || hpos < glyph_row->used[TEXT_AREA]) | 23540 | || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA])) |
| 23534 | glyph = glyph_row->glyphs[TEXT_AREA] + hpos; | 23541 | glyph = glyph_row->glyphs[TEXT_AREA] + hpos; |
| 23535 | 23542 | ||
| 23536 | xassert (interrupt_input_blocked); | 23543 | xassert (interrupt_input_blocked); |