diff options
| author | Paul Eggert | 2011-08-05 16:35:10 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-08-05 16:35:10 -0700 |
| commit | 458bfed397af18e460d01b888d1da095b6b95034 (patch) | |
| tree | 6f3933c2deab13b0df064d87e7b6fa25d835cfcb /src | |
| parent | 0e51f7172bd1ab8b9c1bb52598afb5017e19b9c3 (diff) | |
| parent | 4640dd881c07162a6120ccb3b117b748badf78c9 (diff) | |
| download | emacs-458bfed397af18e460d01b888d1da095b6b95034.tar.gz emacs-458bfed397af18e460d01b888d1da095b6b95034.zip | |
Merge from trunk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 28 | ||||
| -rw-r--r-- | src/bidi.c | 75 | ||||
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/dispnew.c | 2 | ||||
| -rw-r--r-- | src/indent.c | 2 | ||||
| -rw-r--r-- | src/window.c | 18 | ||||
| -rw-r--r-- | src/xdisp.c | 74 |
7 files changed, 127 insertions, 74 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 94e7d98f813..53925dae403 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -408,6 +408,34 @@ | |||
| 408 | (gs_load): Use printmax_t to print the widest integers possible. | 408 | (gs_load): Use printmax_t to print the widest integers possible. |
| 409 | Check for integer overflow when computing image height and width. | 409 | Check for integer overflow when computing image height and width. |
| 410 | 410 | ||
| 411 | 2011-08-05 Eli Zaretskii <eliz@gnu.org> | ||
| 412 | |||
| 413 | * bidi.c <bidi_cache_total_alloc>: Now static. | ||
| 414 | (bidi_initialize): Initialize bidi_cache_total_alloc. | ||
| 415 | |||
| 416 | *xdisp.c (display_line): Release buffer allocated for shelved bidi | ||
| 417 | cache. (Bug#9221) | ||
| 418 | |||
| 419 | * bidi.c (bidi_shelve_cache, bidi_unshelve_cache): Track total | ||
| 420 | amount allocated this far in `bidi_cache_total_alloc'. | ||
| 421 | (bidi_unshelve_cache): Accept an additional argument JUST_FREE; if | ||
| 422 | non-zero, only free the data buffer without restoring the cache | ||
| 423 | contents. All callers changed. | ||
| 424 | |||
| 425 | * dispextern.h (bidi_unshelve_cache): Update prototype. | ||
| 426 | |||
| 427 | * xdisp.c (SAVE_IT, pos_visible_p, move_it_in_display_line_to) | ||
| 428 | (move_it_in_display_line, move_it_to) | ||
| 429 | (move_it_vertically_backward, move_it_by_lines): Replace the call | ||
| 430 | to xfree to an equivalent call to bidi_unshelve_cache. | ||
| 431 | (move_it_in_display_line_to): Fix logic of returning | ||
| 432 | MOVE_POS_MATCH_OR_ZV in the bidi case. (Bug#9224) | ||
| 433 | |||
| 434 | 2011-08-05 Eli Zaretskii <eliz@gnu.org> | ||
| 435 | |||
| 436 | * xdisp.c (set_cursor_from_row): Prefer the candidate glyph that | ||
| 437 | came from a string character with a `cursor' property. (Bug#9229) | ||
| 438 | |||
| 411 | 2011-08-04 Jan Djärv <jan.h.d@swipnet.se> | 439 | 2011-08-04 Jan Djärv <jan.h.d@swipnet.se> |
| 412 | 440 | ||
| 413 | * Makefile.in (LIB_PTHREAD): New variable. | 441 | * Makefile.in (LIB_PTHREAD): New variable. |
diff --git a/src/bidi.c b/src/bidi.c index f499ec37b9e..f6ad22f8ea2 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -628,17 +628,24 @@ bidi_pop_it (struct bidi_it *bidi_it) | |||
| 628 | bidi_cache_last_idx = -1; | 628 | bidi_cache_last_idx = -1; |
| 629 | } | 629 | } |
| 630 | 630 | ||
| 631 | static ptrdiff_t bidi_cache_total_alloc; | ||
| 632 | |||
| 631 | /* Stash away a copy of the cache and its control variables. */ | 633 | /* Stash away a copy of the cache and its control variables. */ |
| 632 | void * | 634 | void * |
| 633 | bidi_shelve_cache (void) | 635 | bidi_shelve_cache (void) |
| 634 | { | 636 | { |
| 635 | unsigned char *databuf; | 637 | unsigned char *databuf; |
| 638 | ptrdiff_t alloc; | ||
| 636 | 639 | ||
| 640 | /* Empty cache. */ | ||
| 637 | if (bidi_cache_idx == 0) | 641 | if (bidi_cache_idx == 0) |
| 638 | return NULL; | 642 | return NULL; |
| 639 | 643 | ||
| 640 | databuf = xmalloc (bidi_shelve_header_size | 644 | alloc = (bidi_shelve_header_size |
| 641 | + bidi_cache_idx * sizeof (struct bidi_it)); | 645 | + bidi_cache_idx * sizeof (struct bidi_it)); |
| 646 | databuf = xmalloc (alloc); | ||
| 647 | bidi_cache_total_alloc += alloc; | ||
| 648 | |||
| 642 | memcpy (databuf, &bidi_cache_idx, sizeof (bidi_cache_idx)); | 649 | memcpy (databuf, &bidi_cache_idx, sizeof (bidi_cache_idx)); |
| 643 | memcpy (databuf + sizeof (bidi_cache_idx), | 650 | memcpy (databuf + sizeof (bidi_cache_idx), |
| 644 | bidi_cache, bidi_cache_idx * sizeof (struct bidi_it)); | 651 | bidi_cache, bidi_cache_idx * sizeof (struct bidi_it)); |
| @@ -664,7 +671,7 @@ bidi_shelve_cache (void) | |||
| 664 | 671 | ||
| 665 | /* Restore the cache state from a copy stashed away by bidi_shelve_cache. */ | 672 | /* Restore the cache state from a copy stashed away by bidi_shelve_cache. */ |
| 666 | void | 673 | void |
| 667 | bidi_unshelve_cache (void *databuf) | 674 | bidi_unshelve_cache (void *databuf, int just_free) |
| 668 | { | 675 | { |
| 669 | unsigned char *p = databuf; | 676 | unsigned char *p = databuf; |
| 670 | 677 | ||
| @@ -677,30 +684,43 @@ bidi_unshelve_cache (void *databuf) | |||
| 677 | } | 684 | } |
| 678 | else | 685 | else |
| 679 | { | 686 | { |
| 680 | memcpy (&bidi_cache_idx, p, sizeof (bidi_cache_idx)); | 687 | if (just_free) |
| 681 | bidi_cache_ensure_space (bidi_cache_idx); | 688 | { |
| 682 | memcpy (bidi_cache, p + sizeof (bidi_cache_idx), | 689 | ptrdiff_t idx; |
| 683 | bidi_cache_idx * sizeof (struct bidi_it)); | 690 | |
| 684 | memcpy (bidi_cache_start_stack, | 691 | memcpy (&idx, p, sizeof (bidi_cache_idx)); |
| 685 | p + sizeof (bidi_cache_idx) | 692 | bidi_cache_total_alloc -= |
| 686 | + bidi_cache_idx * sizeof (struct bidi_it), | 693 | bidi_shelve_header_size + idx * sizeof (struct bidi_it); |
| 687 | sizeof (bidi_cache_start_stack)); | 694 | } |
| 688 | memcpy (&bidi_cache_sp, | 695 | else |
| 689 | p + sizeof (bidi_cache_idx) | 696 | { |
| 690 | + bidi_cache_idx * sizeof (struct bidi_it) | 697 | memcpy (&bidi_cache_idx, p, sizeof (bidi_cache_idx)); |
| 691 | + sizeof (bidi_cache_start_stack), | 698 | bidi_cache_ensure_space (bidi_cache_idx); |
| 692 | sizeof (bidi_cache_sp)); | 699 | memcpy (bidi_cache, p + sizeof (bidi_cache_idx), |
| 693 | memcpy (&bidi_cache_start, | 700 | bidi_cache_idx * sizeof (struct bidi_it)); |
| 694 | p + sizeof (bidi_cache_idx) | 701 | memcpy (bidi_cache_start_stack, |
| 695 | + bidi_cache_idx * sizeof (struct bidi_it) | 702 | p + sizeof (bidi_cache_idx) |
| 696 | + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp), | 703 | + bidi_cache_idx * sizeof (struct bidi_it), |
| 697 | sizeof (bidi_cache_start)); | 704 | sizeof (bidi_cache_start_stack)); |
| 698 | memcpy (&bidi_cache_last_idx, | 705 | memcpy (&bidi_cache_sp, |
| 699 | p + sizeof (bidi_cache_idx) | 706 | p + sizeof (bidi_cache_idx) |
| 700 | + bidi_cache_idx * sizeof (struct bidi_it) | 707 | + bidi_cache_idx * sizeof (struct bidi_it) |
| 701 | + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) | 708 | + sizeof (bidi_cache_start_stack), |
| 702 | + sizeof (bidi_cache_start), | 709 | sizeof (bidi_cache_sp)); |
| 703 | sizeof (bidi_cache_last_idx)); | 710 | memcpy (&bidi_cache_start, |
| 711 | p + sizeof (bidi_cache_idx) | ||
| 712 | + bidi_cache_idx * sizeof (struct bidi_it) | ||
| 713 | + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp), | ||
| 714 | sizeof (bidi_cache_start)); | ||
| 715 | memcpy (&bidi_cache_last_idx, | ||
| 716 | p + sizeof (bidi_cache_idx) | ||
| 717 | + bidi_cache_idx * sizeof (struct bidi_it) | ||
| 718 | + sizeof (bidi_cache_start_stack) + sizeof (bidi_cache_sp) | ||
| 719 | + sizeof (bidi_cache_start), | ||
| 720 | sizeof (bidi_cache_last_idx)); | ||
| 721 | bidi_cache_total_alloc -= | ||
| 722 | bidi_shelve_header_size + bidi_cache_idx * sizeof (struct bidi_it); | ||
| 723 | } | ||
| 704 | 724 | ||
| 705 | xfree (p); | 725 | xfree (p); |
| 706 | } | 726 | } |
| @@ -747,6 +767,7 @@ bidi_initialize (void) | |||
| 747 | staticpro (¶graph_separate_re); | 767 | staticpro (¶graph_separate_re); |
| 748 | 768 | ||
| 749 | bidi_cache_sp = 0; | 769 | bidi_cache_sp = 0; |
| 770 | bidi_cache_total_alloc = 0; | ||
| 750 | 771 | ||
| 751 | bidi_initialized = 1; | 772 | bidi_initialized = 1; |
| 752 | } | 773 | } |
diff --git a/src/dispextern.h b/src/dispextern.h index 49761310180..02d1089e3e7 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2979,7 +2979,7 @@ extern int bidi_mirror_char (int); | |||
| 2979 | extern void bidi_push_it (struct bidi_it *); | 2979 | extern void bidi_push_it (struct bidi_it *); |
| 2980 | extern void bidi_pop_it (struct bidi_it *); | 2980 | extern void bidi_pop_it (struct bidi_it *); |
| 2981 | extern void *bidi_shelve_cache (void); | 2981 | extern void *bidi_shelve_cache (void); |
| 2982 | extern void bidi_unshelve_cache (void *); | 2982 | extern void bidi_unshelve_cache (void *, int); |
| 2983 | 2983 | ||
| 2984 | /* Defined in xdisp.c */ | 2984 | /* Defined in xdisp.c */ |
| 2985 | 2985 | ||
diff --git a/src/dispnew.c b/src/dispnew.c index fde9be6bf5c..5fedbb75a3a 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -5289,7 +5289,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5289 | argument is ZV to prevent move_it_in_display_line from matching | 5289 | argument is ZV to prevent move_it_in_display_line from matching |
| 5290 | based on buffer positions. */ | 5290 | based on buffer positions. */ |
| 5291 | move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); | 5291 | move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); |
| 5292 | bidi_unshelve_cache (itdata); | 5292 | bidi_unshelve_cache (itdata, 0); |
| 5293 | 5293 | ||
| 5294 | Fset_buffer (old_current_buffer); | 5294 | Fset_buffer (old_current_buffer); |
| 5295 | 5295 | ||
diff --git a/src/indent.c b/src/indent.c index 37873351aa0..313315e9081 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -2126,7 +2126,7 @@ whether or not it is currently displayed in some window. */) | |||
| 2126 | } | 2126 | } |
| 2127 | 2127 | ||
| 2128 | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); | 2128 | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
| 2129 | bidi_unshelve_cache (itdata); | 2129 | bidi_unshelve_cache (itdata, 0); |
| 2130 | } | 2130 | } |
| 2131 | 2131 | ||
| 2132 | if (BUFFERP (old_buffer)) | 2132 | if (BUFFERP (old_buffer)) |
diff --git a/src/window.c b/src/window.c index 04fea6b9bf6..96b1144acf2 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1379,7 +1379,7 @@ if it isn't already recorded. */) | |||
| 1379 | if (it.current_y < it.last_visible_y) | 1379 | if (it.current_y < it.last_visible_y) |
| 1380 | move_it_past_eol (&it); | 1380 | move_it_past_eol (&it); |
| 1381 | value = make_number (IT_CHARPOS (it)); | 1381 | value = make_number (IT_CHARPOS (it)); |
| 1382 | bidi_unshelve_cache (itdata); | 1382 | bidi_unshelve_cache (itdata, 0); |
| 1383 | 1383 | ||
| 1384 | if (old_buffer) | 1384 | if (old_buffer) |
| 1385 | set_buffer_internal (old_buffer); | 1385 | set_buffer_internal (old_buffer); |
| @@ -4273,7 +4273,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4273 | } | 4273 | } |
| 4274 | 4274 | ||
| 4275 | start = it.current.pos; | 4275 | start = it.current.pos; |
| 4276 | bidi_unshelve_cache (itdata); | 4276 | bidi_unshelve_cache (itdata, 0); |
| 4277 | } | 4277 | } |
| 4278 | else if (auto_window_vscroll_p) | 4278 | else if (auto_window_vscroll_p) |
| 4279 | { | 4279 | { |
| @@ -4417,7 +4417,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4417 | } | 4417 | } |
| 4418 | else | 4418 | else |
| 4419 | { | 4419 | { |
| 4420 | bidi_unshelve_cache (itdata); | 4420 | bidi_unshelve_cache (itdata, 0); |
| 4421 | if (noerror) | 4421 | if (noerror) |
| 4422 | return; | 4422 | return; |
| 4423 | else if (n < 0) /* could happen with empty buffers */ | 4423 | else if (n < 0) /* could happen with empty buffers */ |
| @@ -4434,7 +4434,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4434 | w->vscroll = 0; | 4434 | w->vscroll = 0; |
| 4435 | else | 4435 | else |
| 4436 | { | 4436 | { |
| 4437 | bidi_unshelve_cache (itdata); | 4437 | bidi_unshelve_cache (itdata, 0); |
| 4438 | if (noerror) | 4438 | if (noerror) |
| 4439 | return; | 4439 | return; |
| 4440 | else | 4440 | else |
| @@ -4583,7 +4583,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4583 | SET_PT_BOTH (charpos, bytepos); | 4583 | SET_PT_BOTH (charpos, bytepos); |
| 4584 | } | 4584 | } |
| 4585 | } | 4585 | } |
| 4586 | bidi_unshelve_cache (itdata); | 4586 | bidi_unshelve_cache (itdata, 0); |
| 4587 | } | 4587 | } |
| 4588 | 4588 | ||
| 4589 | 4589 | ||
| @@ -5010,7 +5010,7 @@ displayed_window_lines (struct window *w) | |||
| 5010 | start_display (&it, w, start); | 5010 | start_display (&it, w, start); |
| 5011 | move_it_vertically (&it, height); | 5011 | move_it_vertically (&it, height); |
| 5012 | bottom_y = line_bottom_y (&it); | 5012 | bottom_y = line_bottom_y (&it); |
| 5013 | bidi_unshelve_cache (itdata); | 5013 | bidi_unshelve_cache (itdata, 0); |
| 5014 | 5014 | ||
| 5015 | /* rms: On a non-window display, | 5015 | /* rms: On a non-window display, |
| 5016 | the value of it.vpos at the bottom of the screen | 5016 | the value of it.vpos at the bottom of the screen |
| @@ -5116,7 +5116,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5116 | move_it_vertically_backward (&it, window_box_height (w) / 2); | 5116 | move_it_vertically_backward (&it, window_box_height (w) / 2); |
| 5117 | charpos = IT_CHARPOS (it); | 5117 | charpos = IT_CHARPOS (it); |
| 5118 | bytepos = IT_BYTEPOS (it); | 5118 | bytepos = IT_BYTEPOS (it); |
| 5119 | bidi_unshelve_cache (itdata); | 5119 | bidi_unshelve_cache (itdata, 0); |
| 5120 | } | 5120 | } |
| 5121 | else if (iarg < 0) | 5121 | else if (iarg < 0) |
| 5122 | { | 5122 | { |
| @@ -5164,7 +5164,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5164 | } | 5164 | } |
| 5165 | if (h <= 0) | 5165 | if (h <= 0) |
| 5166 | { | 5166 | { |
| 5167 | bidi_unshelve_cache (itdata); | 5167 | bidi_unshelve_cache (itdata, 0); |
| 5168 | return Qnil; | 5168 | return Qnil; |
| 5169 | } | 5169 | } |
| 5170 | 5170 | ||
| @@ -5187,7 +5187,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5187 | charpos = IT_CHARPOS (it); | 5187 | charpos = IT_CHARPOS (it); |
| 5188 | bytepos = IT_BYTEPOS (it); | 5188 | bytepos = IT_BYTEPOS (it); |
| 5189 | 5189 | ||
| 5190 | bidi_unshelve_cache (itdata); | 5190 | bidi_unshelve_cache (itdata, 0); |
| 5191 | } | 5191 | } |
| 5192 | else | 5192 | else |
| 5193 | { | 5193 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index bffb7bcdd73..481dd35c5d0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -604,7 +604,7 @@ int current_mode_line_height, current_header_line_height; | |||
| 604 | #define SAVE_IT(ITCOPY,ITORIG,CACHE) \ | 604 | #define SAVE_IT(ITCOPY,ITORIG,CACHE) \ |
| 605 | do { \ | 605 | do { \ |
| 606 | if (CACHE) \ | 606 | if (CACHE) \ |
| 607 | xfree (CACHE); \ | 607 | bidi_unshelve_cache (CACHE, 1); \ |
| 608 | ITCOPY = ITORIG; \ | 608 | ITCOPY = ITORIG; \ |
| 609 | CACHE = bidi_shelve_cache(); \ | 609 | CACHE = bidi_shelve_cache(); \ |
| 610 | } while (0) | 610 | } while (0) |
| @@ -613,7 +613,7 @@ int current_mode_line_height, current_header_line_height; | |||
| 613 | do { \ | 613 | do { \ |
| 614 | if (pITORIG != pITCOPY) \ | 614 | if (pITORIG != pITCOPY) \ |
| 615 | *(pITORIG) = *(pITCOPY); \ | 615 | *(pITORIG) = *(pITCOPY); \ |
| 616 | bidi_unshelve_cache (CACHE); \ | 616 | bidi_unshelve_cache (CACHE, 0); \ |
| 617 | CACHE = NULL; \ | 617 | CACHE = NULL; \ |
| 618 | } while (0) | 618 | } while (0) |
| 619 | 619 | ||
| @@ -1341,9 +1341,9 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y, | |||
| 1341 | *vpos = it2.vpos; | 1341 | *vpos = it2.vpos; |
| 1342 | } | 1342 | } |
| 1343 | else | 1343 | else |
| 1344 | xfree (it2data); | 1344 | bidi_unshelve_cache (it2data, 1); |
| 1345 | } | 1345 | } |
| 1346 | bidi_unshelve_cache (itdata); | 1346 | bidi_unshelve_cache (itdata, 0); |
| 1347 | 1347 | ||
| 1348 | if (old_buffer) | 1348 | if (old_buffer) |
| 1349 | set_buffer_internal_1 (old_buffer); | 1349 | set_buffer_internal_1 (old_buffer); |
| @@ -2624,7 +2624,7 @@ init_iterator (struct it *it, struct window *w, | |||
| 2624 | it->paragraph_embedding = R2L; | 2624 | it->paragraph_embedding = R2L; |
| 2625 | else | 2625 | else |
| 2626 | it->paragraph_embedding = NEUTRAL_DIR; | 2626 | it->paragraph_embedding = NEUTRAL_DIR; |
| 2627 | bidi_unshelve_cache (NULL); | 2627 | bidi_unshelve_cache (NULL, 0); |
| 2628 | bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), | 2628 | bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), |
| 2629 | &it->bidi_it); | 2629 | &it->bidi_it); |
| 2630 | } | 2630 | } |
| @@ -5615,7 +5615,7 @@ back_to_previous_visible_line_start (struct it *it) | |||
| 5615 | pos = --IT_CHARPOS (it2); | 5615 | pos = --IT_CHARPOS (it2); |
| 5616 | --IT_BYTEPOS (it2); | 5616 | --IT_BYTEPOS (it2); |
| 5617 | it2.sp = 0; | 5617 | it2.sp = 0; |
| 5618 | bidi_unshelve_cache (NULL); | 5618 | bidi_unshelve_cache (NULL, 0); |
| 5619 | it2.string_from_display_prop_p = 0; | 5619 | it2.string_from_display_prop_p = 0; |
| 5620 | it2.from_disp_prop_p = 0; | 5620 | it2.from_disp_prop_p = 0; |
| 5621 | if (handle_display_prop (&it2) == HANDLED_RETURN | 5621 | if (handle_display_prop (&it2) == HANDLED_RETURN |
| @@ -5825,7 +5825,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) | |||
| 5825 | { | 5825 | { |
| 5826 | bidi_init_it (IT_CHARPOS (*it), IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), | 5826 | bidi_init_it (IT_CHARPOS (*it), IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), |
| 5827 | &it->bidi_it); | 5827 | &it->bidi_it); |
| 5828 | bidi_unshelve_cache (NULL); | 5828 | bidi_unshelve_cache (NULL, 0); |
| 5829 | it->bidi_it.paragraph_dir = NEUTRAL_DIR; | 5829 | it->bidi_it.paragraph_dir = NEUTRAL_DIR; |
| 5830 | it->bidi_it.string.s = NULL; | 5830 | it->bidi_it.string.s = NULL; |
| 5831 | it->bidi_it.string.lstring = Qnil; | 5831 | it->bidi_it.string.lstring = Qnil; |
| @@ -8006,13 +8006,13 @@ move_it_in_display_line_to (struct it *it, | |||
| 8006 | positions smaller than TO_CHARPOS, return | 8006 | positions smaller than TO_CHARPOS, return |
| 8007 | MOVE_POS_MATCH_OR_ZV, like the unidirectional display | 8007 | MOVE_POS_MATCH_OR_ZV, like the unidirectional display |
| 8008 | did. */ | 8008 | did. */ |
| 8009 | if ((op & MOVE_TO_POS) != 0 | 8009 | if (it->bidi_p && (op & MOVE_TO_POS) != 0 |
| 8010 | && !saw_smaller_pos | 8010 | && !saw_smaller_pos |
| 8011 | && IT_CHARPOS (*it) > to_charpos) | 8011 | && IT_CHARPOS (*it) > to_charpos) |
| 8012 | { | 8012 | { |
| 8013 | result = MOVE_POS_MATCH_OR_ZV; | 8013 | if (IT_CHARPOS (ppos_it) < ZV) |
| 8014 | if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) | ||
| 8015 | RESTORE_IT (it, &ppos_it, ppos_data); | 8014 | RESTORE_IT (it, &ppos_it, ppos_data); |
| 8015 | goto buffer_pos_reached; | ||
| 8016 | } | 8016 | } |
| 8017 | else | 8017 | else |
| 8018 | result = MOVE_NEWLINE_OR_CR; | 8018 | result = MOVE_NEWLINE_OR_CR; |
| @@ -8051,14 +8051,13 @@ move_it_in_display_line_to (struct it *it, | |||
| 8051 | character positions smaller than TO_CHARPOS, | 8051 | character positions smaller than TO_CHARPOS, |
| 8052 | return MOVE_POS_MATCH_OR_ZV, like the | 8052 | return MOVE_POS_MATCH_OR_ZV, like the |
| 8053 | unidirectional display did. */ | 8053 | unidirectional display did. */ |
| 8054 | || ((op & MOVE_TO_POS) != 0 | 8054 | || (it->bidi_p && (op & MOVE_TO_POS) != 0 |
| 8055 | && !saw_smaller_pos | 8055 | && !saw_smaller_pos |
| 8056 | && IT_CHARPOS (*it) > to_charpos)) | 8056 | && IT_CHARPOS (*it) > to_charpos)) |
| 8057 | { | 8057 | { |
| 8058 | result = MOVE_POS_MATCH_OR_ZV; | 8058 | if (!at_eob_p && IT_CHARPOS (ppos_it) < ZV) |
| 8059 | if (it->bidi_p && !at_eob_p && IT_CHARPOS (ppos_it) < ZV) | ||
| 8060 | RESTORE_IT (it, &ppos_it, ppos_data); | 8059 | RESTORE_IT (it, &ppos_it, ppos_data); |
| 8061 | break; | 8060 | goto buffer_pos_reached; |
| 8062 | } | 8061 | } |
| 8063 | if (ITERATOR_AT_END_OF_LINE_P (it)) | 8062 | if (ITERATOR_AT_END_OF_LINE_P (it)) |
| 8064 | { | 8063 | { |
| @@ -8066,14 +8065,13 @@ move_it_in_display_line_to (struct it *it, | |||
| 8066 | break; | 8065 | break; |
| 8067 | } | 8066 | } |
| 8068 | } | 8067 | } |
| 8069 | else if ((op & MOVE_TO_POS) != 0 | 8068 | else if (it->bidi_p && (op & MOVE_TO_POS) != 0 |
| 8070 | && !saw_smaller_pos | 8069 | && !saw_smaller_pos |
| 8071 | && IT_CHARPOS (*it) > to_charpos) | 8070 | && IT_CHARPOS (*it) > to_charpos) |
| 8072 | { | 8071 | { |
| 8073 | result = MOVE_POS_MATCH_OR_ZV; | 8072 | if (IT_CHARPOS (ppos_it) < ZV) |
| 8074 | if (it->bidi_p && IT_CHARPOS (ppos_it) < ZV) | ||
| 8075 | RESTORE_IT (it, &ppos_it, ppos_data); | 8073 | RESTORE_IT (it, &ppos_it, ppos_data); |
| 8076 | break; | 8074 | goto buffer_pos_reached; |
| 8077 | } | 8075 | } |
| 8078 | result = MOVE_LINE_TRUNCATED; | 8076 | result = MOVE_LINE_TRUNCATED; |
| 8079 | break; | 8077 | break; |
| @@ -8093,13 +8091,13 @@ move_it_in_display_line_to (struct it *it, | |||
| 8093 | done: | 8091 | done: |
| 8094 | 8092 | ||
| 8095 | if (atpos_data) | 8093 | if (atpos_data) |
| 8096 | xfree (atpos_data); | 8094 | bidi_unshelve_cache (atpos_data, 1); |
| 8097 | if (atx_data) | 8095 | if (atx_data) |
| 8098 | xfree (atx_data); | 8096 | bidi_unshelve_cache (atx_data, 1); |
| 8099 | if (wrap_data) | 8097 | if (wrap_data) |
| 8100 | xfree (wrap_data); | 8098 | bidi_unshelve_cache (wrap_data, 1); |
| 8101 | if (ppos_data) | 8099 | if (ppos_data) |
| 8102 | xfree (ppos_data); | 8100 | bidi_unshelve_cache (ppos_data, 1); |
| 8103 | 8101 | ||
| 8104 | /* Restore the iterator settings altered at the beginning of this | 8102 | /* Restore the iterator settings altered at the beginning of this |
| 8105 | function. */ | 8103 | function. */ |
| @@ -8134,7 +8132,7 @@ move_it_in_display_line (struct it *it, | |||
| 8134 | (it, -1, prev_x, MOVE_TO_X); | 8132 | (it, -1, prev_x, MOVE_TO_X); |
| 8135 | } | 8133 | } |
| 8136 | else | 8134 | else |
| 8137 | xfree (save_data); | 8135 | bidi_unshelve_cache (save_data, 1); |
| 8138 | } | 8136 | } |
| 8139 | else | 8137 | else |
| 8140 | move_it_in_display_line_to (it, to_charpos, to_x, op); | 8138 | move_it_in_display_line_to (it, to_charpos, to_x, op); |
| @@ -8393,7 +8391,7 @@ move_it_to (struct it *it, EMACS_INT to_charpos, int to_x, int to_y, int to_vpos | |||
| 8393 | } | 8391 | } |
| 8394 | 8392 | ||
| 8395 | if (backup_data) | 8393 | if (backup_data) |
| 8396 | xfree (backup_data); | 8394 | bidi_unshelve_cache (backup_data, 1); |
| 8397 | 8395 | ||
| 8398 | TRACE_MOVE ((stderr, "move_it_to: reached %d\n", reached)); | 8396 | TRACE_MOVE ((stderr, "move_it_to: reached %d\n", reached)); |
| 8399 | } | 8397 | } |
| @@ -8472,7 +8470,7 @@ move_it_vertically_backward (struct it *it, int dy) | |||
| 8472 | RESTORE_IT (it, it, it2data); | 8470 | RESTORE_IT (it, it, it2data); |
| 8473 | if (nlines > 0) | 8471 | if (nlines > 0) |
| 8474 | move_it_by_lines (it, nlines); | 8472 | move_it_by_lines (it, nlines); |
| 8475 | xfree (it3data); | 8473 | bidi_unshelve_cache (it3data, 1); |
| 8476 | } | 8474 | } |
| 8477 | else | 8475 | else |
| 8478 | { | 8476 | { |
| @@ -8668,7 +8666,7 @@ move_it_by_lines (struct it *it, int dvpos) | |||
| 8668 | if (IT_CHARPOS (*it) >= start_charpos) | 8666 | if (IT_CHARPOS (*it) >= start_charpos) |
| 8669 | RESTORE_IT (it, &it2, it2data); | 8667 | RESTORE_IT (it, &it2, it2data); |
| 8670 | else | 8668 | else |
| 8671 | xfree (it2data); | 8669 | bidi_unshelve_cache (it2data, 1); |
| 8672 | } | 8670 | } |
| 8673 | else | 8671 | else |
| 8674 | RESTORE_IT (it, it, it2data); | 8672 | RESTORE_IT (it, it, it2data); |
| @@ -13704,14 +13702,12 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13704 | w->cursor.vpos >= 0 | 13702 | w->cursor.vpos >= 0 |
| 13705 | /* that candidate is not the row we are processing */ | 13703 | /* that candidate is not the row we are processing */ |
| 13706 | && MATRIX_ROW (matrix, w->cursor.vpos) != row | 13704 | && MATRIX_ROW (matrix, w->cursor.vpos) != row |
| 13707 | /* the row we are processing is part of a continued line */ | ||
| 13708 | && (row->continued_p || MATRIX_ROW_CONTINUATION_LINE_P (row)) | ||
| 13709 | /* Make sure cursor.vpos specifies a row whose start and end | 13705 | /* Make sure cursor.vpos specifies a row whose start and end |
| 13710 | charpos occlude point. This is because some callers of this | 13706 | charpos occlude point. This is because some callers of this |
| 13711 | function leave cursor.vpos at the row where the cursor was | 13707 | function leave cursor.vpos at the row where the cursor was |
| 13712 | displayed during the last redisplay cycle. */ | 13708 | displayed during the last redisplay cycle. */ |
| 13713 | && MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) <= pt_old | 13709 | && MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) <= pt_old |
| 13714 | && pt_old < MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))) | 13710 | && pt_old <= MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))) |
| 13715 | { | 13711 | { |
| 13716 | struct glyph *g1 = | 13712 | struct glyph *g1 = |
| 13717 | MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos; | 13713 | MATRIX_ROW_GLYPH_START (matrix, w->cursor.vpos) + w->cursor.hpos; |
| @@ -13720,15 +13716,20 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13720 | if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)) | 13716 | if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)) |
| 13721 | return 0; | 13717 | return 0; |
| 13722 | /* Keep the candidate whose buffer position is the closest to | 13718 | /* Keep the candidate whose buffer position is the closest to |
| 13723 | point. */ | 13719 | point or has the `cursor' property. */ |
| 13724 | if (/* previous candidate is a glyph in TEXT_AREA of that row */ | 13720 | if (/* previous candidate is a glyph in TEXT_AREA of that row */ |
| 13725 | w->cursor.hpos >= 0 | 13721 | w->cursor.hpos >= 0 |
| 13726 | && w->cursor.hpos < MATRIX_ROW_USED (matrix, w->cursor.vpos) | 13722 | && w->cursor.hpos < MATRIX_ROW_USED (matrix, w->cursor.vpos) |
| 13727 | && BUFFERP (g1->object) | 13723 | && ((BUFFERP (g1->object) |
| 13728 | && (g1->charpos == pt_old /* an exact match always wins */ | 13724 | && (g1->charpos == pt_old /* an exact match always wins */ |
| 13729 | || (BUFFERP (glyph->object) | 13725 | || (BUFFERP (glyph->object) |
| 13730 | && eabs (g1->charpos - pt_old) | 13726 | && eabs (g1->charpos - pt_old) |
| 13731 | < eabs (glyph->charpos - pt_old)))) | 13727 | < eabs (glyph->charpos - pt_old)))) |
| 13728 | /* previous candidate is a glyph from a string that has | ||
| 13729 | a non-nil `cursor' property */ | ||
| 13730 | || (STRINGP (g1->object) | ||
| 13731 | && !NILP (Fget_char_property (make_number (g1->charpos), | ||
| 13732 | Qcursor, g1->object))))) | ||
| 13732 | return 0; | 13733 | return 0; |
| 13733 | /* If this candidate gives an exact match, use that. */ | 13734 | /* If this candidate gives an exact match, use that. */ |
| 13734 | if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old) | 13735 | if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old) |
| @@ -18774,6 +18775,9 @@ display_line (struct it *it) | |||
| 18774 | } | 18775 | } |
| 18775 | } | 18776 | } |
| 18776 | 18777 | ||
| 18778 | if (wrap_data) | ||
| 18779 | bidi_unshelve_cache (wrap_data, 1); | ||
| 18780 | |||
| 18777 | /* If line is not empty and hscrolled, maybe insert truncation glyphs | 18781 | /* If line is not empty and hscrolled, maybe insert truncation glyphs |
| 18778 | at the left window margin. */ | 18782 | at the left window margin. */ |
| 18779 | if (it->first_visible_x | 18783 | if (it->first_visible_x |