diff mde/content/AStringContent.d @ 167:620d4ea30228

Context menus: added a clipboard (functions accessible from main menu rather than context menu).
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 27 Jun 2009 11:57:26 +0200
parents bb2f1a76346d
children e45226d3deae
line wrap: on
line diff
--- a/mde/content/AStringContent.d	Sun Jun 21 12:19:18 2009 +0200
+++ b/mde/content/AStringContent.d	Sat Jun 27 11:57:26 2009 +0200
@@ -83,6 +83,12 @@
 	return false;
     }
     
+    /** Set value directly from a string. */
+    override void opAssign (char[] str) {
+	sv = str.dup;
+	return endEdit;
+    }
+    
     /** Acts on a keystroke to edit the value as a string.
      *
      * After this has been used to edit the string, endEdit should be called
@@ -181,6 +187,7 @@
     bool endEdit ();
     
 protected:
+    //TODO: copy-on-assign, copy-on-edit, or what?
     /* String version of value (for toString(0) and editing).
      * WARNING: This must point to mutable memory (for endEdit), and
      * when keyStroke can be called we must have svBuf[0..sv.length] == sv. */
@@ -256,7 +263,7 @@
     }
     
     void assignNoCng (char[] val) {
-	v = val;
+	v = val.dup;
 	if (pos > sv.length) pos = sv.length;
         endEvent;
     }