Don't insert a brace before a renamed variable

1TBS Artistic Style enables the add-braces option, which adds braces to
unbraced one line conditional statements. When a user renames a
variable, each file that mentions this variable is reformatted by the
current formatter. KDevelop::extractFormattedTextFromContext() then
attempts to extract only the variable and the whitespaces that surround
it from the formatted file. But this function's implementation does not
expect or handle an opening or closing brace inserted just before the
renamed variable.

The fix is to detect a non-whitespace character between leftContext and
text, then give up formatting and return the unformatted text from
extractFormattedTextFromContext(). This implementation is much easier
and safer than figuring out which characters were inserted before the
text or removed from the beginning of the text; then removing all
inserted non-whitespace characters and possibly some whitespaces (e.g.
those that don't make sense without the eliminated brace), or restoring
the characters removed from the text and possibly some removed

BUG: 365437
1 job for !118 with fix-extractFormattedTextFromContext in 55 minutes and 37 seconds (queued for 1 second)
latest detached
Status Job ID Name Coverage
passed #39241
linux kf5-qt5 qt5.12