aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2003-09-30 11:07:55 +0000
committerKenichi Handa2003-09-30 11:07:55 +0000
commite53d2f0069d07b6823b0698cf441fe6f3843b7bc (patch)
treead8964105382d953831d3f567ada7a56f55f164a /src
parent90ed648a4f3a8cee2d3deb2114700472d80e021f (diff)
downloademacs-e53d2f0069d07b6823b0698cf441fe6f3843b7bc.tar.gz
emacs-e53d2f0069d07b6823b0698cf441fe6f3843b7bc.zip
(handle_auto_composed_prop): Check if the last
characters of auto-composed region is newly composed with the following characters. (handle_composition_prop): Fix checking of point being inside composition.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c56
1 files changed, 48 insertions, 8 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 04e74f1e7e1..12dca91d0ac 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3774,17 +3774,48 @@ handle_auto_composed_prop (it)
3774{ 3774{
3775 enum prop_handled handled = HANDLED_NORMALLY; 3775 enum prop_handled handled = HANDLED_NORMALLY;
3776 3776
3777 if (! NILP (Vauto_composition_function)) 3777 if (FUNCTIONP (Vauto_composition_function))
3778 { 3778 {
3779 Lisp_Object val; 3779 Lisp_Object val;
3780 int pos; 3780 EMACS_INT pos, this_pos;
3781 3781
3782 if (STRINGP (it->string)) 3782 if (STRINGP (it->string))
3783 pos = IT_STRING_CHARPOS (*it); 3783 pos = IT_STRING_CHARPOS (*it);
3784 else 3784 else
3785 pos = IT_CHARPOS (*it); 3785 pos = IT_CHARPOS (*it);
3786 this_pos = pos;
3786 3787
3787 val =Fget_char_property (make_number (pos), Qauto_composed, it->string); 3788 val =Fget_char_property (make_number (pos), Qauto_composed, it->string);
3789 if (! NILP (val))
3790 {
3791 Lisp_Object next;
3792
3793 next = (Fnext_single_property_change
3794 (make_number (pos), Qauto_composed, it->string, Qnil));
3795 if (INTEGERP (next))
3796 {
3797 /* The current point is auto-composed, but there exist
3798 characers not yet composed beyond the auto-compused
3799 region. There's a possiblity that the last
3800 characters in the region may be newly composed. */
3801 int charpos = XINT (next) - 1, bytepos, c;
3802
3803 if (STRINGP (it->string))
3804 {
3805 bytepos = string_char_to_byte (it->string, charpos);
3806 c = SDATA (it->string)[bytepos];
3807 }
3808 else
3809 {
3810 bytepos = CHAR_TO_BYTE (charpos);
3811 c = FETCH_BYTE (bytepos);
3812 }
3813 if (c != '\n')
3814 /* If the last character is not newline, it may be
3815 composed with the following characters. */
3816 val = Qnil, pos = charpos + 1;
3817 }
3818 }
3788 if (NILP (val)) 3819 if (NILP (val))
3789 { 3820 {
3790 int count = SPECPDL_INDEX (); 3821 int count = SPECPDL_INDEX ();
@@ -3798,7 +3829,7 @@ handle_auto_composed_prop (it)
3798 unbind_to (count, Qnil); 3829 unbind_to (count, Qnil);
3799 3830
3800 val = Fget_char_property (args[1], Qauto_composed, it->string); 3831 val = Fget_char_property (args[1], Qauto_composed, it->string);
3801 if (! NILP (val)) 3832 if (! NILP (val) && this_pos == pos)
3802 handled = HANDLED_RECOMPUTE_PROPS; 3833 handled = HANDLED_RECOMPUTE_PROPS;
3803 } 3834 }
3804 } 3835 }
@@ -3814,7 +3845,7 @@ handle_composition_prop (it)
3814 struct it *it; 3845 struct it *it;
3815{ 3846{
3816 Lisp_Object prop, string; 3847 Lisp_Object prop, string;
3817 EMACS_INT pos, pos_byte, end; 3848 EMACS_INT pos, pos_byte, start, end;
3818 enum prop_handled handled = HANDLED_NORMALLY; 3849 enum prop_handled handled = HANDLED_NORMALLY;
3819 3850
3820 if (STRINGP (it->string)) 3851 if (STRINGP (it->string))
@@ -3833,11 +3864,20 @@ handle_composition_prop (it)
3833 /* If there's a valid composition and point is not inside of the 3864 /* If there's a valid composition and point is not inside of the
3834 composition (in the case that the composition is from the current 3865 composition (in the case that the composition is from the current
3835 buffer), draw a glyph composed from the composition components. */ 3866 buffer), draw a glyph composed from the composition components. */
3836 if (find_composition (pos, -1, &pos, &end, &prop, string) 3867 if (find_composition (pos, -1, &start, &end, &prop, string)
3837 && COMPOSITION_VALID_P (pos, end, prop) 3868 && COMPOSITION_VALID_P (start, end, prop)
3838 && (STRINGP (it->string) || (PT <= pos || PT >= end))) 3869 && (STRINGP (it->string) || (PT <= start || PT >= end)))
3839 { 3870 {
3840 int id = get_composition_id (pos, pos_byte, end - pos, prop, string); 3871 int id;
3872
3873 if (start != pos)
3874 {
3875 if (STRINGP (it->string))
3876 pos_byte = string_char_to_byte (it->string, start);
3877 else
3878 pos_byte = CHAR_TO_BYTE (start);
3879 }
3880 id = get_composition_id (start, pos_byte, end - start, prop, string);
3841 3881
3842 if (id >= 0) 3882 if (id >= 0)
3843 { 3883 {