Fix crash in variable expansion (used by external tools)
Summary:
findClosing() is already called with +2 to account for the
starting %{ characters. So we start at the given pos and
increment it only after the while loop. Unbalanced cases
of '{' and '}' are now also unit tested.
Test Plan: make && make test
Reviewers: cullmann
Reviewed By: cullmann
Subscribers: kwrite-devel, kde-frameworks-devel
Tags: Kate, Frameworks
Differential Revision: https://phabricator.kde.org/D26811