Fix Jira issue #ROOT-6221: Text editor does not allow negative positions

Apply patch kindly sent by Matthew Strait