diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog.bidi | 14 | ||||
| -rw-r--r-- | src/buffer.c | 8 | ||||
| -rw-r--r-- | src/buffer.h | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 66 |
4 files changed, 75 insertions, 15 deletions
diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi index a09ce293823..2f800e5ecd2 100644 --- a/src/ChangeLog.bidi +++ b/src/ChangeLog.bidi | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2009-11-14 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (init_iterator, text_outside_line_unchanged_p) | ||
| 4 | (try_window_id): Rename paragraph_direction to | ||
| 5 | bidi_paragraph_direction. | ||
| 6 | (set_cursor_from_row): Handle integer values of `cursor' property | ||
| 7 | on display strings. | ||
| 8 | |||
| 9 | * buffer.c (init_buffer_once, syms_of_buffer): Rename | ||
| 10 | paragraph_direction to bidi_paragraph_direction. | ||
| 11 | |||
| 12 | * buffer.h (struct buffer): Rename paragraph_direction to | ||
| 13 | bidi_paragraph_direction. | ||
| 14 | |||
| 1 | 2009-11-07 Eli Zaretskii <eliz@gnu.org> | 15 | 2009-11-07 Eli Zaretskii <eliz@gnu.org> |
| 2 | 16 | ||
| 3 | * bidi.c (bidi_paragraph_init): Don't overstep end of buffer. | 17 | * bidi.c (bidi_paragraph_init): Don't overstep end of buffer. |
diff --git a/src/buffer.c b/src/buffer.c index 0d9247eb61b..521fe9b5019 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5188,7 +5188,7 @@ init_buffer_once () | |||
| 5188 | buffer_defaults.ctl_arrow = Qt; | 5188 | buffer_defaults.ctl_arrow = Qt; |
| 5189 | buffer_defaults.bidi_display_reordering = Qnil; | 5189 | buffer_defaults.bidi_display_reordering = Qnil; |
| 5190 | buffer_defaults.direction_reversed = Qnil; | 5190 | buffer_defaults.direction_reversed = Qnil; |
| 5191 | buffer_defaults.paragraph_direction = Qnil; | 5191 | buffer_defaults.bidi_paragraph_direction = Qnil; |
| 5192 | buffer_defaults.cursor_type = Qt; | 5192 | buffer_defaults.cursor_type = Qt; |
| 5193 | buffer_defaults.extra_line_spacing = Qnil; | 5193 | buffer_defaults.extra_line_spacing = Qnil; |
| 5194 | buffer_defaults.cursor_in_non_selected_windows = Qt; | 5194 | buffer_defaults.cursor_in_non_selected_windows = Qt; |
| @@ -5275,7 +5275,7 @@ init_buffer_once () | |||
| 5275 | XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; | 5275 | XSETFASTINT (buffer_local_flags.category_table, idx); ++idx; |
| 5276 | XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; | 5276 | XSETFASTINT (buffer_local_flags.bidi_display_reordering, idx); ++idx; |
| 5277 | XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx; | 5277 | XSETFASTINT (buffer_local_flags.direction_reversed, idx); ++idx; |
| 5278 | XSETFASTINT (buffer_local_flags.paragraph_direction, idx); ++idx; | 5278 | XSETFASTINT (buffer_local_flags.bidi_paragraph_direction, idx); ++idx; |
| 5279 | XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); | 5279 | XSETFASTINT (buffer_local_flags.buffer_file_coding_system, idx); |
| 5280 | /* Make this one a permanent local. */ | 5280 | /* Make this one a permanent local. */ |
| 5281 | buffer_permanent_local_flags[idx++] = 1; | 5281 | buffer_permanent_local_flags[idx++] = 1; |
| @@ -5798,8 +5798,8 @@ See also the variable `bidi-display-reordering'. */); | |||
| 5798 | doc: /* Non-nil means reorder bidirectional text for display in the visual order. | 5798 | doc: /* Non-nil means reorder bidirectional text for display in the visual order. |
| 5799 | See also the variable `direction-reversed'. */); | 5799 | See also the variable `direction-reversed'. */); |
| 5800 | 5800 | ||
| 5801 | DEFVAR_PER_BUFFER ("paragraph-direction", | 5801 | DEFVAR_PER_BUFFER ("bidi-paragraph-direction", |
| 5802 | ¤t_buffer->paragraph_direction, Qnil, | 5802 | ¤t_buffer->bidi_paragraph_direction, Qnil, |
| 5803 | doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. | 5803 | doc: /* *If non-nil, forces directionality of text paragraphs in the buffer. |
| 5804 | 5804 | ||
| 5805 | If this is nil (the default), the direction of each paragraph is | 5805 | If this is nil (the default), the direction of each paragraph is |
diff --git a/src/buffer.h b/src/buffer.h index b3f131a46c1..3b6ff0e8bfb 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -667,7 +667,7 @@ struct buffer | |||
| 667 | /* If non-nil, specifies which direction of text to force in all the | 667 | /* If non-nil, specifies which direction of text to force in all the |
| 668 | paragraphs of the buffer. Nil means determine paragraph | 668 | paragraphs of the buffer. Nil means determine paragraph |
| 669 | direction dynamically for each paragraph. */ | 669 | direction dynamically for each paragraph. */ |
| 670 | Lisp_Object paragraph_direction; | 670 | Lisp_Object bidi_paragraph_direction; |
| 671 | /* Non-nil means do selective display; | 671 | /* Non-nil means do selective display; |
| 672 | see doc string in syms_of_buffer (buffer.c) for details. */ | 672 | see doc string in syms_of_buffer (buffer.c) for details. */ |
| 673 | Lisp_Object selective_display; | 673 | Lisp_Object selective_display; |
diff --git a/src/xdisp.c b/src/xdisp.c index 6b2e046b82b..180031be055 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2813,9 +2813,9 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) | |||
| 2813 | { | 2813 | { |
| 2814 | /* Note the paragraph direction that this buffer wants to | 2814 | /* Note the paragraph direction that this buffer wants to |
| 2815 | use. */ | 2815 | use. */ |
| 2816 | if (EQ (current_buffer->paragraph_direction, Qleft_to_right)) | 2816 | if (EQ (current_buffer->bidi_paragraph_direction, Qleft_to_right)) |
| 2817 | it->paragraph_embedding = L2R; | 2817 | it->paragraph_embedding = L2R; |
| 2818 | else if (EQ (current_buffer->paragraph_direction, Qright_to_left)) | 2818 | else if (EQ (current_buffer->bidi_paragraph_direction, Qright_to_left)) |
| 2819 | it->paragraph_embedding = R2L; | 2819 | it->paragraph_embedding = R2L; |
| 2820 | else | 2820 | else |
| 2821 | it->paragraph_embedding = NEUTRAL_DIR; | 2821 | it->paragraph_embedding = NEUTRAL_DIR; |
| @@ -11162,7 +11162,7 @@ text_outside_line_unchanged_p (w, start, end) | |||
| 11162 | to find the paragraph limits and widen the range of redisplayed | 11162 | to find the paragraph limits and widen the range of redisplayed |
| 11163 | lines to that, but for now just give up this optimization. */ | 11163 | lines to that, but for now just give up this optimization. */ |
| 11164 | if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering) | 11164 | if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering) |
| 11165 | && NILP (XBUFFER (w->buffer)->paragraph_direction)) | 11165 | && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction)) |
| 11166 | unchanged_p = 0; | 11166 | unchanged_p = 0; |
| 11167 | } | 11167 | } |
| 11168 | 11168 | ||
| @@ -12468,6 +12468,11 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 12468 | /* Non-zero means we've seen at least one glyph that came from a | 12468 | /* Non-zero means we've seen at least one glyph that came from a |
| 12469 | display string. */ | 12469 | display string. */ |
| 12470 | int string_seen = 0; | 12470 | int string_seen = 0; |
| 12471 | /* Largest buffer position seen during scan of glyph row. */ | ||
| 12472 | EMACS_INT bpos_max = 0; | ||
| 12473 | /* Last buffer position covered by an overlay string with an integer | ||
| 12474 | `cursor' property. */ | ||
| 12475 | EMACS_INT bpos_covered = 0; | ||
| 12471 | 12476 | ||
| 12472 | /* Skip over glyphs not having an object at the start and the end of | 12477 | /* Skip over glyphs not having an object at the start and the end of |
| 12473 | the row. These are special glyphs like truncation marks on | 12478 | the row. These are special glyphs like truncation marks on |
| @@ -12548,6 +12553,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 12548 | { | 12553 | { |
| 12549 | EMACS_INT dpos = glyph->charpos - pt_old; | 12554 | EMACS_INT dpos = glyph->charpos - pt_old; |
| 12550 | 12555 | ||
| 12556 | if (glyph->charpos > bpos_max) | ||
| 12557 | bpos_max = glyph->charpos; | ||
| 12551 | if (!glyph->avoid_cursor_p) | 12558 | if (!glyph->avoid_cursor_p) |
| 12552 | { | 12559 | { |
| 12553 | /* If we hit point, we've found the glyph on which to | 12560 | /* If we hit point, we've found the glyph on which to |
| @@ -12577,7 +12584,27 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 12577 | match_with_avoid_cursor = 1; | 12584 | match_with_avoid_cursor = 1; |
| 12578 | } | 12585 | } |
| 12579 | else if (STRINGP (glyph->object)) | 12586 | else if (STRINGP (glyph->object)) |
| 12580 | string_seen = 1; | 12587 | { |
| 12588 | Lisp_Object chprop; | ||
| 12589 | int glyph_pos = glyph->charpos; | ||
| 12590 | |||
| 12591 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, | ||
| 12592 | glyph->object); | ||
| 12593 | if (INTEGERP (chprop)) | ||
| 12594 | { | ||
| 12595 | bpos_covered = bpos_max + XINT (chprop); | ||
| 12596 | /* If the `cursor' property covers buffer positions up | ||
| 12597 | to and including point, we should display cursor on | ||
| 12598 | this glyph. */ | ||
| 12599 | if (bpos_covered >= pt_old) | ||
| 12600 | { | ||
| 12601 | cursor = glyph; | ||
| 12602 | break; | ||
| 12603 | } | ||
| 12604 | } | ||
| 12605 | |||
| 12606 | string_seen = 1; | ||
| 12607 | } | ||
| 12581 | x += glyph->pixel_width; | 12608 | x += glyph->pixel_width; |
| 12582 | ++glyph; | 12609 | ++glyph; |
| 12583 | } | 12610 | } |
| @@ -12588,6 +12615,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 12588 | { | 12615 | { |
| 12589 | EMACS_INT dpos = glyph->charpos - pt_old; | 12616 | EMACS_INT dpos = glyph->charpos - pt_old; |
| 12590 | 12617 | ||
| 12618 | if (glyph->charpos > bpos_max) | ||
| 12619 | bpos_max = glyph->charpos; | ||
| 12591 | if (!glyph->avoid_cursor_p) | 12620 | if (!glyph->avoid_cursor_p) |
| 12592 | { | 12621 | { |
| 12593 | if (dpos == 0) | 12622 | if (dpos == 0) |
| @@ -12610,7 +12639,26 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 12610 | match_with_avoid_cursor = 1; | 12639 | match_with_avoid_cursor = 1; |
| 12611 | } | 12640 | } |
| 12612 | else if (STRINGP (glyph->object)) | 12641 | else if (STRINGP (glyph->object)) |
| 12613 | string_seen = 1; | 12642 | { |
| 12643 | Lisp_Object chprop; | ||
| 12644 | int glyph_pos = glyph->charpos; | ||
| 12645 | |||
| 12646 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, | ||
| 12647 | glyph->object); | ||
| 12648 | if (INTEGERP (chprop)) | ||
| 12649 | { | ||
| 12650 | bpos_covered = bpos_max + XINT (chprop); | ||
| 12651 | /* If the `cursor' property covers buffer positions up | ||
| 12652 | to and including point, we should display cursor on | ||
| 12653 | this glyph. */ | ||
| 12654 | if (bpos_covered >= pt_old) | ||
| 12655 | { | ||
| 12656 | cursor = glyph; | ||
| 12657 | break; | ||
| 12658 | } | ||
| 12659 | } | ||
| 12660 | string_seen = 1; | ||
| 12661 | } | ||
| 12614 | --glyph; | 12662 | --glyph; |
| 12615 | if (glyph == end) | 12663 | if (glyph == end) |
| 12616 | break; | 12664 | break; |
| @@ -12620,7 +12668,8 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 12620 | /* Step 2: If we didn't find an exact match for point, we need to | 12668 | /* Step 2: If we didn't find an exact match for point, we need to |
| 12621 | look for a proper place to put the cursor among glyphs between | 12669 | look for a proper place to put the cursor among glyphs between |
| 12622 | GLYPH_BEFORE and GLYPH_AFTER. */ | 12670 | GLYPH_BEFORE and GLYPH_AFTER. */ |
| 12623 | if (glyph->charpos != pt_old) | 12671 | if (!(BUFFERP (glyph->object) && glyph->charpos == pt_old) |
| 12672 | && bpos_covered < pt_old) | ||
| 12624 | { | 12673 | { |
| 12625 | if (row->ends_in_ellipsis_p && pos_after == last_pos) | 12674 | if (row->ends_in_ellipsis_p && pos_after == last_pos) |
| 12626 | { | 12675 | { |
| @@ -12707,9 +12756,6 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 12707 | cprop = Fget_char_property (make_number (gpos), | 12756 | cprop = Fget_char_property (make_number (gpos), |
| 12708 | Qcursor, | 12757 | Qcursor, |
| 12709 | glyph->object); | 12758 | glyph->object); |
| 12710 | /* FIXME: This loses the feature of the | ||
| 12711 | unidirectional redisplay when the | ||
| 12712 | property value was an integer. */ | ||
| 12713 | if (!NILP (cprop)) | 12759 | if (!NILP (cprop)) |
| 12714 | { | 12760 | { |
| 12715 | cursor = glyph; | 12761 | cursor = glyph; |
| @@ -15242,7 +15288,7 @@ try_window_id (w) | |||
| 15242 | lines to that, but for now just give up this optimization and | 15288 | lines to that, but for now just give up this optimization and |
| 15243 | redisplay from scratch. */ | 15289 | redisplay from scratch. */ |
| 15244 | if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering) | 15290 | if (!NILP (XBUFFER (w->buffer)->bidi_display_reordering) |
| 15245 | && NILP (XBUFFER (w->buffer)->paragraph_direction)) | 15291 | && NILP (XBUFFER (w->buffer)->bidi_paragraph_direction)) |
| 15246 | GIVE_UP (22); | 15292 | GIVE_UP (22); |
| 15247 | 15293 | ||
| 15248 | /* Make sure beg_unchanged and end_unchanged are up to date. Do it | 15294 | /* Make sure beg_unchanged and end_unchanged are up to date. Do it |