DocumentPrivate: Make bracket handling smart
This patch checks if the entered closing bracket is already balanced and
skip the input in this case. Targets the "nested autbracket" problem
without to base on this enabled config setting.
BUG:368580
FIXED-IN: 5.58
Differential Revision: https://phabricator.kde.org/D19608