[Differential] [Commented On] D4234: Change algorithm for autobrace.
Jérémy Girard
noreply at phabricator.kde.org
Thu Feb 16 22:41:16 UTC 2017
cactus added a comment.
Hello,
In the case of void foo(bar); the both solution has the same result. But when you have 2 levels of bracket the result are different.
In the example of :
if (isEndMatching())
or
printf("Bonjour")
With auto-brackets enabled and with the old behavior, if you type every char you obtain :
if (isEndMatching()))
and
printf("Bonjour"))
To have 2 levels of bracket is very common.
For example, in the diff below you have :
if (view->config()->autoBrackets() && chars.size() == 1) {
closingBracket = matchingEndBracket(chars[0], true);
if ( m_currentAutobraceClosingChar == chars[0] && m_currentAutobraceRange ) {
if (!closingBracket.isNull() && !skipAutobrace ) {
if (!(config()->backspaceIndents())) {
const auto nextChar = view->document()->text({cursorPos, cursorPos + Cursor{0, 1}}).trimmed();
uint col = qMax(c.column(), 0);
removeText(KTextEditor::Range(line - 1, textLine->length(), line, 0));
I think more than 1/2 of this below code use more than 1 level of bracket and the current code isn't enough smart to eat them.
@dhaumann: I don't feel demotivated by this and I would try to help more. I don't have time now but it is not because you reject my patch than I stop to want helping you.
The behavior of auto-bracket is a personal choice. I think the current code is frustrating to me but I understand some other people dislike my patch.
REPOSITORY
R39 KTextEditor
REVISION DETAIL
https://phabricator.kde.org/D4234
EMAIL PREFERENCES
https://phabricator.kde.org/settings/panel/emailpreferences/
To: cactus, #ktexteditor
Cc: anthonyfieroni, dhaumann, brauch, cullmann, kwrite-devel, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170216/d65e17b0/attachment.html>
More information about the Kde-frameworks-devel
mailing list