title: Setting range to tinymce: Index or size is negative or greater than the allowed amount
body: <p><strong>Here's my code:</strong></p>
  
  <pre><code>range.setStart(range.startContainer, index);
  range.setEnd(range.startContainer, parseInt(index) + parseInt((ed.line.text.split(' ')[2] || "").length));
  </code></pre>
  
  <p><strong>These are the values from the console:</strong></p>
  
  <pre><code>index: 1
  eindex + (ed.line.text.split(' ')[2] || "").length: 2
  ed.line.text.length: 2
  </code></pre>
  
  <p>And why do I get this error?:</p>
  
  <blockquote>
    <p>Index or size is negative or greater than the allowed amount</p>
  </blockquote>