Index: tests/collections/string-overwrite.cfa
===================================================================
--- tests/collections/string-overwrite.cfa	(revision 55b060d686d3cac576f0c518302b16344a6fb205)
+++ tests/collections/string-overwrite.cfa	(revision e8b3717356ccae5e6e9b884e3b31caa47d950414)
@@ -9,6 +9,8 @@
 MS = modifier start
 ME = modifier end
+ML = modifier length
 WS = witness start
 WE = witness end
+WL = witness length
 
 The test does:
@@ -71,11 +73,14 @@
 
 
-void showOneReplacement(string & s, int ms, int me, int ws, int we, const char* replaceWith) {
+void showOneReplacement(string & s, int ms, int ml, int ws, int wl, const char* replaceWith) {
+
+    int me = ms + ml;
+    int we = ws + wl;
 
     assert( ms >= 0 && ms <= me && me <= size(s) );
     assert( ws >= 0 && ws <= we && we <= size(s) );
 
-    string mod = s(ms, me)`shareEdits;
-    string wit = s(ws, we)`shareEdits;
+    string mod = s(ms, ml)`shareEdits;
+    string wit = s(ws, wl)`shareEdits;
 
     string modOld = mod;
@@ -118,115 +123,115 @@
 void runReplaceCases() {
     char * alphabetTemplate = "abcdefghijklmnopqrstuvwxyz";
-    struct { int ms; int me; int ws; int we; char *replaceWith; char *label; } cases[] = {
-        { 12, 14, 10, 20, "xxxxx", "warmup" },
-        { 10, 10, 10, 10, "=====", "1"      },
-        { 10, 10, 10, 10, "=="   , ""       },
-        { 10, 10, 10, 10, "="    , ""       },
-        { 10, 10, 10, 10, ""     , ""       },
-        { 10, 12, 12, 12, "=====", "2"      },
-        { 10, 12, 12, 12, "=="   , ""       },
-        { 10, 12, 12, 12, "="    , ""       },
-        { 10, 12, 12, 12, ""     , ""       },
-        { 12, 12, 10, 12, "=====", "3"      },
-        { 12, 12, 10, 12, "=="   , ""       },
-        { 12, 12, 10, 12, "="    , ""       },
-        { 12, 12, 10, 12, ""     , ""       },
-        { 10, 10, 12, 12, "=====", "4"      },
-        { 10, 10, 12, 12, "=="   , ""       },
-        { 10, 10, 12, 12, "="    , ""       },
-        { 10, 10, 12, 12, ""     , ""       },
-        { 12, 12, 10, 10, "=====", "5"      },
-        { 12, 12, 10, 10, "=="   , ""       },
-        { 12, 12, 10, 10, "="    , ""       },
-        { 12, 12, 10, 10, ""     , ""       },
-        { 10, 12, 10, 12, "=====", "6"      },
-        { 10, 12, 10, 12, "=="   , ""       },
-        { 10, 12, 10, 12, "="    , ""       },
-        { 10, 12, 10, 12, ""     , ""       },
-        { 10, 12, 10, 10, "=====", "7"      },
-        { 10, 12, 10, 10, "=="   , ""       },
-        { 10, 12, 10, 10, "="    , ""       },
-        { 10, 12, 10, 10, ""     , ""       },
-        { 10, 10, 10, 12, "=====", "8"      },
-        { 10, 10, 10, 12, "=="   , ""       },
-        { 10, 10, 10, 12, "="    , ""       },
-        { 10, 10, 10, 12, ""     , ""       },
-        { 10, 12, 14, 14, "=====", "9"      },
-        { 10, 12, 14, 14, "=="   , ""       },
-        { 10, 12, 14, 14, "="    , ""       },
-        { 10, 12, 14, 14, ""     , ""       },
-        { 10, 14, 12, 14, "=====", "10"     },
-        { 10, 14, 12, 14, "=="   , ""       },
-        { 10, 14, 12, 14, "="    , ""       },  // FORMERLY unrunnable bug: tries to print seemingly infinite string
-        { 10, 14, 12, 14, ""     , ""       },  // ditto
-        { 14, 14, 10, 12, "=====", "11"     },
-        { 14, 14, 10, 12, "=="   , ""       },
-        { 14, 14, 10, 12, "="    , ""       },
-        { 14, 14, 10, 12, ""     , ""       },
-        { 12, 14, 10, 14, "=====", "12"     }, // correctness observation:  watching klmn while mn |-> xxx gives klxxx because the mn is inside what I'm watching
-        { 12, 14, 10, 14, "=="   , ""       },
-        { 12, 14, 10, 14, "="    , ""       },
-        { 12, 14, 10, 14, ""     , ""       },
-        { 10, 12, 12, 14, "=====", "13"     },
-        { 10, 12, 12, 14, "=="   , ""       },
-        { 10, 12, 12, 14, "="    , ""       },
-        { 10, 12, 12, 14, ""     , ""       },
-        { 10, 14, 12, 12, "=====", "14"     },
-        { 10, 14, 12, 12, "=="   , ""       },
-        { 10, 14, 12, 12, "="    , ""       },
-        { 10, 14, 12, 12, ""     , ""       },
-        { 12, 14, 10, 12, "=====", "15"     },
-        { 12, 14, 10, 12, "=="   , ""       },
-        { 12, 14, 10, 12, "="    , ""       },
-        { 12, 14, 10, 12, ""     , ""       },
-        { 12, 12, 10, 14, "=====", "16"     },
-        { 12, 12, 10, 14, "=="   , ""       },
-        { 12, 12, 10, 14, "="    , ""       },
-        { 12, 12, 10, 14, ""     , ""       },
-        { 10, 14, 10, 12, "=====", "17"     },
-        { 10, 14, 10, 12, "=="   , ""       },
-        { 10, 14, 10, 12, "="    , ""       },
-        { 10, 14, 10, 12, ""     , ""       },
-        { 10, 10, 12, 14, "=====", "18"     },
-        { 10, 10, 12, 14, "=="   , ""       },
-        { 10, 10, 12, 14, "="    , ""       },
-        { 10, 10, 12, 14, ""     , ""       },
-        { 10, 12, 10, 14, "=====", "19"     },
-        { 10, 12, 10, 14, "=="   , ""       },
-        { 10, 12, 10, 14, "="    , ""       },
-        { 10, 12, 10, 14, ""     , ""       },
-        { 12, 14, 10, 10, "=====", "20"     },
-        { 12, 14, 10, 10, "=="   , ""       },
-        { 12, 14, 10, 10, "="    , ""       },
-        { 12, 14, 10, 10, ""     , ""       },
-        { 10, 12, 14, 16, "=====", "21"     },
-        { 10, 12, 14, 16, "=="   , ""       },
-        { 10, 12, 14, 16, "="    , ""       },
-        { 10, 12, 14, 16, ""     , ""       },
-        { 10, 14, 12, 16, "=====", "22"     },
-        { 10, 14, 12, 16, "=="   , ""       },
-        { 10, 14, 12, 16, "="    , ""       },
-        { 10, 14, 12, 16, ""     , ""       },
-        { 10, 16, 12, 14, "=====", "23"     },
-        { 10, 16, 12, 14, "=="   , ""       },
-        { 10, 16, 12, 14, "="    , ""       },
-        { 10, 16, 12, 14, ""     , ""       },
-        { 14, 16, 10, 12, "=====", "24"     },
-        { 14, 16, 10, 12, "=="   , ""       },
-        { 14, 16, 10, 12, "="    , ""       },
-        { 14, 16, 10, 12, ""     , ""       },
-        { 12, 16, 10, 14, "=====", "25"     },
-        { 12, 16, 10, 14, "=="   , ""       },
-        { 12, 16, 10, 14, "="    , ""       },
-        { 12, 16, 10, 14, ""     , ""       },
-        { 12, 14, 10, 16, "=====", "26"     },
-        { 12, 14, 10, 16, "=="   , ""       },
-        { 12, 14, 10, 16, "="    , ""       },
-        { 12, 14, 10, 16, ""     , ""       },
+    struct { int ms; int ml; int ws; int wl; char *replaceWith; char *label; } cases[] = {
+        { 12,  2, 10, 10, "xxxxx", "warmup" },
+        { 10,  0, 10,  0, "=====", "1"      },
+        { 10,  0, 10,  0, "=="   , ""       },
+        { 10,  0, 10,  0, "="    , ""       },
+        { 10,  0, 10,  0, ""     , ""       },
+        { 10,  2, 12,  0, "=====", "2"      },
+        { 10,  2, 12,  0, "=="   , ""       },
+        { 10,  2, 12,  0, "="    , ""       },
+        { 10,  2, 12,  0, ""     , ""       },
+        { 12,  0, 10,  2, "=====", "3"      },
+        { 12,  0, 10,  2, "=="   , ""       },
+        { 12,  0, 10,  2, "="    , ""       },
+        { 12,  0, 10,  2, ""     , ""       },
+        { 10,  0, 12,  0, "=====", "4"      },
+        { 10,  0, 12,  0, "=="   , ""       },
+        { 10,  0, 12,  0, "="    , ""       },
+        { 10,  0, 12,  0, ""     , ""       },
+        { 12,  0, 10,  0, "=====", "5"      },
+        { 12,  0, 10,  0, "=="   , ""       },
+        { 12,  0, 10,  0, "="    , ""       },
+        { 12,  0, 10,  0, ""     , ""       },
+        { 10,  2, 10,  2, "=====", "6"      },
+        { 10,  2, 10,  2, "=="   , ""       },
+        { 10,  2, 10,  2, "="    , ""       },
+        { 10,  2, 10,  2, ""     , ""       },
+        { 10,  2, 10,  0, "=====", "7"      },
+        { 10,  2, 10,  0, "=="   , ""       },
+        { 10,  2, 10,  0, "="    , ""       },
+        { 10,  2, 10,  0, ""     , ""       },
+        { 10,  0, 10,  2, "=====", "8"      },
+        { 10,  0, 10,  2, "=="   , ""       },
+        { 10,  0, 10,  2, "="    , ""       },
+        { 10,  0, 10,  2, ""     , ""       },
+        { 10,  2, 14,  0, "=====", "9"      },
+        { 10,  2, 14,  0, "=="   , ""       },
+        { 10,  2, 14,  0, "="    , ""       },
+        { 10,  2, 14,  0, ""     , ""       },
+        { 10,  4, 12,  2, "=====", "10"     },
+        { 10,  4, 12,  2, "=="   , ""       },
+        { 10,  4, 12,  2, "="    , ""       },  // FORMERLY unrunnable bug: tries to print seemingly infinite string
+        { 10,  4, 12,  2, ""     , ""       },  // ditto
+        { 14,  0, 10,  2, "=====", "11"     },
+        { 14,  0, 10,  2, "=="   , ""       },
+        { 14,  0, 10,  2, "="    , ""       },
+        { 14,  0, 10,  2, ""     , ""       },
+        { 12,  2, 10,  4, "=====", "12"     }, // correctness observation:  watching klmn while mn |-> xxx gives klxxx because the mn is inside what I'm watching
+        { 12,  2, 10,  4, "=="   , ""       },
+        { 12,  2, 10,  4, "="    , ""       },
+        { 12,  2, 10,  4, ""     , ""       },
+        { 10,  2, 12,  2, "=====", "13"     },
+        { 10,  2, 12,  2, "=="   , ""       },
+        { 10,  2, 12,  2, "="    , ""       },
+        { 10,  2, 12,  2, ""     , ""       },
+        { 10,  4, 12,  0, "=====", "14"     },
+        { 10,  4, 12,  0, "=="   , ""       },
+        { 10,  4, 12,  0, "="    , ""       },
+        { 10,  4, 12,  0, ""     , ""       },
+        { 12,  2, 10,  2, "=====", "15"     },
+        { 12,  2, 10,  2, "=="   , ""       },
+        { 12,  2, 10,  2, "="    , ""       },
+        { 12,  2, 10,  2, ""     , ""       },
+        { 12,  0, 10,  4, "=====", "16"     },
+        { 12,  0, 10,  4, "=="   , ""       },
+        { 12,  0, 10,  4, "="    , ""       },
+        { 12,  0, 10,  4, ""     , ""       },
+        { 10,  4, 10,  2, "=====", "17"     },
+        { 10,  4, 10,  2, "=="   , ""       },
+        { 10,  4, 10,  2, "="    , ""       },
+        { 10,  4, 10,  2, ""     , ""       },
+        { 10,  0, 12,  2, "=====", "18"     },
+        { 10,  0, 12,  2, "=="   , ""       },
+        { 10,  0, 12,  2, "="    , ""       },
+        { 10,  0, 12,  2, ""     , ""       },
+        { 10,  2, 10,  4, "=====", "19"     },
+        { 10,  2, 10,  4, "=="   , ""       },
+        { 10,  2, 10,  4, "="    , ""       },
+        { 10,  2, 10,  4, ""     , ""       },
+        { 12,  2, 10,  0, "=====", "20"     },
+        { 12,  2, 10,  0, "=="   , ""       },
+        { 12,  2, 10,  0, "="    , ""       },
+        { 12,  2, 10,  0, ""     , ""       },
+        { 10,  2, 14,  2, "=====", "21"     },
+        { 10,  2, 14,  2, "=="   , ""       },
+        { 10,  2, 14,  2, "="    , ""       },
+        { 10,  2, 14,  2, ""     , ""       },
+        { 10,  4, 12,  4, "=====", "22"     },
+        { 10,  4, 12,  4, "=="   , ""       },
+        { 10,  4, 12,  4, "="    , ""       },
+        { 10,  4, 12,  4, ""     , ""       },
+        { 10,  6, 12,  2, "=====", "23"     },
+        { 10,  6, 12,  2, "=="   , ""       },
+        { 10,  6, 12,  2, "="    , ""       },
+        { 10,  6, 12,  2, ""     , ""       },
+        { 14,  2, 10,  2, "=====", "24"     },
+        { 14,  2, 10,  2, "=="   , ""       },
+        { 14,  2, 10,  2, "="    , ""       },
+        { 14,  2, 10,  2, ""     , ""       },
+        { 12,  4, 10,  4, "=====", "25"     },
+        { 12,  4, 10,  4, "=="   , ""       },
+        { 12,  4, 10,  4, "="    , ""       },
+        { 12,  4, 10,  4, ""     , ""       },
+        { 12,  2, 10,  6, "=====", "26"     },
+        { 12,  2, 10,  6, "=="   , ""       },
+        { 12,  2, 10,  6, "="    , ""       },
+        { 12,  2, 10,  6, ""     , ""       },
     };
     for ( i; sizeof(cases)/sizeof(cases[0]) ) {
         sout | "------------------------------------------------------------------------" | cases[i].label;
         string replaceIn = alphabetTemplate;
-        showOneReplacement( replaceIn, cases[i].ms, cases[i].me, cases[i].ws, cases[i].we, cases[i].replaceWith );
+        showOneReplacement( replaceIn, cases[i].ms, cases[i].ml, cases[i].ws, cases[i].wl, cases[i].replaceWith );
     }
 }
@@ -244,10 +249,10 @@
     string s = "abcdefghijklmnopqrstuvwxyz";
 
-    s(5,10) = "qqqqq";  // start=5, end=10, len=5
-
-    sout | s;
-
-
-    s(5,5) = "-----";  // start=5, end=5, len=0
+    s(5,5) = "qqqqq";  // start=5, end=10, len=5
+
+    sout | s;
+
+
+    s(5,0) = "-----";  // start=5, end=5, len=0
 
     sout | s;
