This is with ktexteditor 5.26.0. The Auto Brackets feature appears to remember only one level of bracketing for purposes of auto-overtyping closing brackets. Only the innermost closing bracket is automatically overwritten. Reproducible: Always Steps to Reproduce: In a new document in KWrite (or Kate, KDevelop, etc.) with Auto Brackets enabled, type more than one opening bracket (of any kind). Then type the corresponding closing brackets (in reverse order). Actual Results: Only the first closing bracket gets automatically overwritten. The remaining closing brackets are inserted instead, leading to excessive closing brackets. Expected Results: All closing brackets should be automatically overwritten if they were automatically inserted and have not yet been automatically overwritten. This worked in KDE 4, presumably because *all* closing brackets were *always* automatically overtyped by matching characters. This was an okay solution, though it confounded the later insertion of additional closing brackets into a run of closing brackets. A better solution would be to remember which closing brackets on the current editing line were automatically inserted and automatically overtype them if and only if the character being typed matches the existing closing bracket and the existing closing bracket has not already been automatically overtyped. (The set of remembered auto-inserted closing brackets can be forgotten when the cursor moves to another line.) Some examples (pipe character indicates cursor position)… Type these five characters: ((a)) Expected result: ((a))| Actual result: ((a))|) Type these seven characters: ({[a]}) Expected result: ({[a]})| Actual result: ({[a]})|})
Git commit 8f0813f6c7ed6da15cdc10030b42c34f7ce98fb0 by loh tar. Committed on 12/04/2019 at 22:29. Pushed by lohtar into branch 'master'. 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. FIXED-IN: 5.58 Differential Revision: https://phabricator.kde.org/D19608 M +12 -0 src/document/katedocument.cpp https://commits.kde.org/ktexteditor/8f0813f6c7ed6da15cdc10030b42c34f7ce98fb0
The new behavior should only be enabled with auto bracketing on - it's super annoying to start out with f(|), type arg() and then end up with f(arg()| instead of f(arg()|).
@Daniel: this was accidentally always on, and it's fixed for 5.59, see: https://bugs.kde.org/show_bug.cgi?id=407852