Subset of clang-format changes.#965
Subset of clang-format changes.#965ahmedcharles merged 2 commits intoMudlet:developmentfrom ahmedcharles:formatting
Conversation
SlySven
left a comment
There was a problem hiding this comment.
I had "gone off the boil" before I got to the end there... so if there are any other issues then they slip by this time. OTOH If there are any issues then because this is just formatting they are not going to be made better or worse by this PR anyhow! 😀
| mInsertedMissingLF = true; | ||
| if( (cmd == "") && ( mUSE_IRE_DRIVER_BUGFIX ) && ( ! mUSE_FORCE_LF_AFTER_PROMPT ) ) | ||
| { | ||
| if ((cmd == "") && (mUSE_IRE_DRIVER_BUGFIX) && (!mUSE_FORCE_LF_AFTER_PROMPT)) { |
There was a problem hiding this comment.
I'd prefer cmd.isEmpty() to avoid a raw string literal. 😁
| sendRaw( "\n" );//NOTE: damit leerprompt moeglich sind | ||
| QStringList commandList = cmd.split(QString(mCommandSeparator), QString::SkipEmptyParts); | ||
| if (!dontExpandAliases) { | ||
| if (commandList.size() == 0) { |
There was a problem hiding this comment.
commandList.isEmpty() is more human readable than commandList.size() == 0 IMVHO...
| continue; | ||
| } | ||
| QString command = commandList[i]; | ||
| command.replace("\n", ""); |
There was a problem hiding this comment.
Isn't this the same as command.remove("\n") - or even better command.remove(QChar::LineFeed)?
| } | ||
| QString command = commandList[i]; | ||
| command.replace("\n", ""); | ||
| mReplacementCommand = ""; |
There was a problem hiding this comment.
As (void) Host::setReplacementCommand(const QString &) is not used, Host::replacementCommand never gets set to anything - so the fact that this clears it and dontExpandAliases is never set I think there is some cruft to clear out in this region.
| } | ||
|
|
||
| void Host::raiseEvent( const TEvent & pE ) | ||
| void Host::raiseEvent(const TEvent& pE) |
There was a problem hiding this comment.
I thought I had been through and replaced pE with event as this is NOT a pointer (any more?) 😖
Ah, turns out that was #934 which I've had to hold to split clean up - so will need to cherry-pick and base on code post this one anyhow...!
| { | ||
| qDebug()<<"CRITICAL ERROR: SHOULD NOT HAPPEN->pcre_info() got wrong num of cap groups ovector only has room for %d captured substrings\n"; | ||
| if (rc == 0) { | ||
| qDebug() << "CRITICAL ERROR: SHOULD NOT HAPPEN->pcre_info() got wrong num of cap groups ovector only has room for %d captured substrings\n"; |
There was a problem hiding this comment.
🪲 same bug as above - but this time I think the constant is 30 (see the pcre_exec(...) call).
| @@ -183,75 +171,75 @@ void TArea::determineAreaExitsOfRoom( int id ) | |||
| // The second term in the ifs below looks for exit room id in TArea | |||
| // instance's own list of rooms which will fail (with a -1 if it is NOT in | |||
There was a problem hiding this comment.
Oops 😊 - I think I forgot to update the comment when I moved to a QSet<int> TArea::rooms data structure - the reference to a -1 result is no longer relevant!
|
|
||
| quotationFormat.setForeground( Qt::darkGreen ); | ||
| rule.pattern = QRegExp( "\"[^\"]*\"" ); | ||
| quotationFormat.setForeground(Qt::darkGreen); |
There was a problem hiding this comment.
🤔 That reminds me, quotation formatting breaks for escaped quotes in the Lua Script editor, i.e. a literal \" is actually treated like a plain " when one wants to embed " in a string to display to the user...
| : QDialog( pF ) | ||
| , mpTrigger( pT ) | ||
| , mMode( mode ) | ||
| dlgColorTrigger::dlgColorTrigger(QWidget* pF, TTrigger* pT, int mode) : QDialog(pF), mpTrigger(pT), mMode(mode) |
There was a problem hiding this comment.
Sorry to pick at something that must be getting a bit scabbed by now but didn't we find a way/want to have the initialisations one per line?
| @@ -404,16 +387,15 @@ void dlgColorTrigger::setColorLightMagenta() | |||
|
|
|||
| void dlgColorTrigger::setColorWhite() | |||
There was a problem hiding this comment.
🤔 IIRC if we could set up a QSignalMappper we could considerably cut down on the "copy and modify" blocks of largely repetitive code here.
|
I am not sure why are you doing a full review of code for a PR that is just about changing the formatting of it... I mean the comments given aren't in scope of the PR and unless someone goes through and addresses them, they'll be lost? |
|
They're very good comments, but addressing them would not be in scope of this PR, so what do we do with them? |
|
*thinks* Of course! That was a stupid thing for me to waste time doing 😒 |
|
Well, I'll work on putting them in for you, don't want any time to be wasted. It just wasn't the right place to do such a thorough review on, |
Ones I felt comfortable with anyhow
| QPair<QString, int> exitData; | ||
| exitData.second = itAreaExit.value().first; | ||
| switch( itAreaExit.value().second ) { | ||
| case DIR_NORTH: exitData.first = QString("north"); break; |
There was a problem hiding this comment.
Would like to keep this - it's far more readable than the exploded variant
No description provided.