This resolution is continuity of what was started by @viict, some adjustments were made to finally solve the problem that causes the cursor to jump to the end of the field when trying to edit or delete its value in the middle. This solution was tested only with BR masks.
Coverage decreased (-1.8%) to 97.281% when pulling a0e06cc7169ae87aaf9075b26779d8d4ffb33df6 on albinojunior:master into 595240a651a327aea7702dcdd17663e0711ff187 on assisrafael:master.
This resolution is continuity of what was started by @viict, some adjustments were made to finally solve the problem that causes the cursor to jump to the end of the field when trying to edit or delete its value in the middle. This solution was tested only with BR masks.