[[ Bug 11928 ]] Make sure we reduce endindex by appropriate amount at the appropriate point in settextindex().
Merge branch 'bugfix-11928' into release-6.6.3