Fix #504.  Update `[ and `] positions when pasting text.