From db15a10a5ec38f122d225dd3219a4190785c60ed Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 17 Jun 2009 12:10:15 +0000 Subject: [PATCH] *** empty log message *** --- MText.cs | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/MText.cs b/MText.cs index 986bad0..beff7e5 100644 --- a/MText.cs +++ b/MText.cs @@ -25,28 +25,35 @@ namespace M17N.Core public enum Flags { None = 0x00, + /// A text inserted before a character that has this property /// inherits this property. If the text already has properties - /// of the same key, they are deleted. + /// of the same key, they are deleted at first. FrontSticky = 0x01, + /// A text inserted after a character that has this property /// inherits this property. If the text already has properties - /// of the same key, they are deleted. + /// of the same key, they are deleted at first. RearSticky = 0x02, + /// This property is deleted from a span of text if the span is /// modified (i.e. a character is changed, a text is inserted, - /// some part is deleted). This propery is also deleted if a + /// some part is deleted). This property is also deleted if a /// property of the same key is added, which means that this - /// property is not stackable. + /// property is not stackable. In addition this property is + /// never merged with the same value of preceding or following + /// property. Sensitive = 0x04, + /// Like Sensitive but also this property is deleted from a span /// of text if a text just before the span is modified, /// inserted, or deleted. - FrontSensitive = 0x08, + FrontSensitive = 0x0C, + /// Like Sensitive but also this property is deleted from a span /// of text if a text just after the span is modified, inserted, /// or deleted. - RearSensitive = 0x10 + RearSensitive = 0x14, }; internal MSymbol key; @@ -663,14 +670,6 @@ namespace M17N.Core MProperty.Flags.RearSensitive) ; } } - public bool isAnySensitive - { - get { return MProperty.HasFlags (Key, - (MProperty.Flags.Sensitive - | MProperty.Flags.RearSensitive - | MProperty.Flags.FrontSensitive)) ; } - } - private void update_from_to () { if (Parent == null) @@ -943,14 +942,14 @@ namespace M17N.Core MInterval tail = find_tail (end); if (! head.Stack.IsEmpty - && (isAnySensitive && head.From < start + && ((isSensitive || isFrontSensitive) && head.From < start || isFrontSensitive && ! first)) { head = copy.find_head (0); head.Stack.Clear (); } if (! tail.Stack.IsEmpty - && (isAnySensitive && end < head.To + && ((isSensitive || isRearSensitive) && end < head.To || isRearSensitive && ! last)) { tail = copy.find_tail (copy.Length); @@ -1404,8 +1403,13 @@ namespace M17N.Core { int len = end - start; - if (isAnySensitive) - Stack.Clear (); + if (isSensitive + || (From < start && isRearSensitive) + || (end < To && isFrontSensitive)) + { + M17n.DebugPrint ("clear this stack\n"); + Stack.Clear (); + } for (MInterval i = this; i != null; i = i.Parent) i.Length -= len; } @@ -1436,7 +1440,7 @@ namespace M17N.Core end = To; } - if (! Stack.IsEmpty && isAnySensitive) + if (! Stack.IsEmpty && isSensitive) Stack.Clear (); if (start > From) divide_left (start); @@ -1560,7 +1564,7 @@ namespace M17N.Core if (! Stack.IsEmpty) { - if (isAnySensitive) + if (isSensitive) Stack.Clear (); else { -- 1.7.10.4