- String left = tobj->GetText().substr(0,offs); // get part before cursor
- VAR(left);
- tobj->GetText() = tobj->GetText().substr(offs,(*i)->CountPositions()-offs); // keeps the right half
- VAR(tobj->GetText());
- insert(i,obj);
- insert(i,new wxLayoutObjectText(left)); // inserts before
- }
+ String left = tobj->GetText().substr(0,offs); // get part before cursor
+ WXL_VAR(left);
+ tobj->GetText() = tobj->GetText().substr(offs,(*i)->CountPositions()-offs); // keeps the right half
+ WXL_VAR(tobj->GetText());
+ insert(i,obj);
+ insert(i,new wxLayoutObjectText(left)); // inserts before
+ }
+ else
+ {
+ // all other cases, append after object:
+ wxLayoutObjectList::iterator j = i; // we want to apend after this object
+ j++;
+ if(j != end())
+ insert(j, obj);