Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit fe4d4388 authored by Sven Brauch's avatar Sven Brauch

fix inserting ; when calling a void function in a non-empty line

BUG:385110
parent 5dbd2b27
......@@ -226,6 +226,8 @@ public:
}
}
auto restEmpty = doc->characterAt(word.end() + KTextEditor::Cursor{0, 1}) == QChar();
bool didAddParentheses = false;
if ( !funcptr && doc->characterAt(word.end()) != QLatin1Char('(') ) {
repl += QLatin1String("()");
......@@ -237,8 +239,8 @@ public:
view->setCursorPosition(word.start() + KTextEditor::Cursor(0, repl.size() - 1));
}
auto returnTypeIntegral = f->returnType().cast<IntegralType>();
if ( !funcptr && returnTypeIntegral && returnTypeIntegral->dataType() == IntegralType::TypeVoid ) {
// function returns void -- nothing can be done with the result
if ( restEmpty && !funcptr && returnTypeIntegral && returnTypeIntegral->dataType() == IntegralType::TypeVoid ) {
// function returns void and rest of line is empty -- nothing can be done with the result
if ( f && f->indexedArgumentsSize() ) {
// we placed the cursor inside the ()
view->document()->insertText(view->cursorPosition() + KTextEditor::Cursor(0, 1), QStringLiteral(";"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment