*** empty log message ***
[m17n/m17n-lib-cs.git] / MText.cs
index 9180c62..14a0696 100644 (file)
--- a/MText.cs
+++ b/MText.cs
@@ -115,7 +115,7 @@ namespace M17N.Core
     private int cache_idx;
     private MPlist intervals;
     private MPlist default_property;
-    private bool read_only;
+    private bool read_only = false;
 
     private static UTF8Encoding utf8 = new UTF8Encoding ();
 
@@ -227,6 +227,16 @@ namespace M17N.Core
 
     public override string ToString () { return sb.ToString (); }
 
+    public static implicit operator MText (string str)
+    {
+      return new MText (str);
+    }
+
+    public static explicit operator string (MText mt)
+    {
+      return mt.ToString ();
+    }
+
     private static int inc_idx (StringBuilder sb, int i)
     {
       return (i + (Char.IsHighSurrogate (sb[i]) ? 2 : 1));
@@ -462,6 +472,11 @@ namespace M17N.Core
       return this;
     }
 
+    public MText Del ()
+    {
+      return Del (0, Length);
+    }
+
     public MText Del (int from, int to)
     {
       if (check_range (from, to, true))
@@ -621,7 +636,8 @@ namespace M17N.Core
 
     public object FindProp (MSymbol key, int pos, out int from, out int to)
     {
-      from = to = pos;
+      from = 0;
+      to = Length;
       check_pos (pos, false);
       
       MInterval i = (MInterval) intervals.Get (key);