Merge remote-tracking branch 'origin/4.11'

Change-Id: Ie1c4de44aa1af20dfb67e20607b9fb4e71445cbe
This commit is contained in:
Eike Ziller
2020-02-12 08:04:14 +01:00
3 changed files with 62 additions and 45 deletions

View File

@@ -181,10 +181,25 @@ def is_not_debug(path, filenames):
def codesign(app_path): def codesign(app_path):
signing_identity = os.environ.get('SIGNING_IDENTITY') signing_identity = os.environ.get('SIGNING_IDENTITY')
if is_mac_platform() and signing_identity: if is_mac_platform() and signing_identity:
codesign_call = ['codesign', '-o', 'runtime', '--force', '--deep', '-s', signing_identity, codesign_call = ['codesign', '-o', 'runtime', '--force', '-s', signing_identity,
'-v'] '-v']
signing_flags = os.environ.get('SIGNING_FLAGS') signing_flags = os.environ.get('SIGNING_FLAGS')
if signing_flags: if signing_flags:
codesign_call.extend(signing_flags.split()) codesign_call.extend(signing_flags.split())
codesign_call.append(app_path)
subprocess.check_call(codesign_call) def conditional_sign_recursive(path, filter):
for r, _, fs in os.walk(path):
for f in fs:
ff = os.path.join(r, f)
if filter(ff):
print('codesign "' + ff + '"')
subprocess.check_call(codesign_call + [ff])
# sign all executables in Resources
conditional_sign_recursive(os.path.join(app_path, 'Contents', 'Resources'),
lambda ff: os.access(ff, os.X_OK))
# sign all libraries in Imports
conditional_sign_recursive(os.path.join(app_path, 'Contents', 'Imports'),
lambda ff: ff.endswith('.dylib'))
# sign the whole bundle
subprocess.check_call(codesign_call + ['--deep', app_path])

View File

@@ -36,34 +36,44 @@ using namespace CPlusPlus;
/*! /*!
\fn void Client::macroAdded(const Macro &macro) \fn void Client::macroAdded(const Macro &macro)
Called whenever a new macro is defined. Called whenever a new \a macro is defined.
*/ */
/*! /*!
\fn void Client::passedMacroDefinitionCheck(int offset, int line, const Macro &macro) \fn void Client::passedMacroDefinitionCheck(int bytesOffset,
int utf16charsOffset,
int line,
const Macro &macro)
Called when the preprocessor checks whether a macro is defined or not and the Called when the preprocessor checks whether \a macro at \a line with
result is positive. \a bytesOffset and \a utf16charsOffset is defined and the result is
positive.
\sa failedMacroDefinitionCheck() \sa failedMacroDefinitionCheck()
*/ */
/*! /*!
\fn void Client::failedMacroDefinitionCheck(int offset, const ByteArrayRef &name) \fn void Client::failedMacroDefinitionCheck(int bytesOffset,
int utf16charsOffset,
const ByteArrayRef &name)
Called when the preprocessor checks whether a macro is defined or not and the Called when the preprocessor checks whether the macro specified by \a name
result is negative. is defined with \a bytesOffset and \a utf16charsOffset and the result is
negative.
\sa passedMacroDefinitionCheck() \sa passedMacroDefinitionCheck()
*/ */
/*! /*!
\fn void Client::startExpandingMacro(int offset, \fn void Client::startExpandingMacro(int bytesOffset,
int line, int utf16charsOffset,
const Macro &macro, int line,
const QVector<MacroArgumentReference> &actuals const Macro &macro,
= QVector<MacroArgumentReference>()) const QVector<MacroArgumentReference> &actuals
Called when starting to expand a macro. = QVector<MacroArgumentReference>())
Called when starting to expand \a macro at \a line with \a bytesOffset,
\a utf16charsOffset, and \a actuals.
\sa stopExpandingMacro() \sa stopExpandingMacro()
*/ */

View File

@@ -78,13 +78,13 @@ public:
bool noAutomaticHighlighting = false; bool noAutomaticHighlighting = false;
}; };
static bool adjustRange(QTextLayout::FormatRange &range, int from, int charsRemoved, int charsAdded) { static bool adjustRange(QTextLayout::FormatRange &range, int from, int charsDelta)
{
if (range.start >= from) { if (range.start >= from) {
range.start += charsAdded - charsRemoved; range.start += charsDelta;
return true; return true;
} else if (range.start + range.length > from) { } else if (range.start + range.length > from) {
range.length += charsAdded - charsRemoved; range.length += charsDelta;
return true; return true;
} }
return false; return false;
@@ -105,32 +105,24 @@ void SyntaxHighlighterPrivate::applyFormatChanges(int from, int charsRemoved, in
QTextLayout *layout = currentBlock.layout(); QTextLayout *layout = currentBlock.layout();
QVector<QTextLayout::FormatRange> ranges = layout->formats(); QVector<QTextLayout::FormatRange> ranges;
QVector<QTextLayout::FormatRange> oldRanges;
std::tie(ranges, oldRanges)
= Utils::partition(layout->formats(), [](const QTextLayout::FormatRange &range) {
return range.format.property(QTextFormat::UserProperty).toBool();
});
bool doAdjustRange = currentBlock.contains(from); if (currentBlock.contains(from)) {
const int charsDelta = charsAdded - charsRemoved;
QVector<QTextLayout::FormatRange> old_ranges; for (QTextLayout::FormatRange &range : ranges)
formatsChanged |= adjustRange(range, from - currentBlock.position(), charsDelta);
if (!ranges.isEmpty()) {
auto it = ranges.begin();
while (it != ranges.end()) {
if (it->format.property(QTextFormat::UserProperty).toBool()) {
if (doAdjustRange)
formatsChanged = adjustRange(*it, from - currentBlock.position(), charsRemoved, charsAdded)
|| formatsChanged;
++it;
} else {
old_ranges.append(*it);
it = ranges.erase(it);
}
}
} }
QTextCharFormat emptyFormat; QTextCharFormat emptyFormat;
QTextLayout::FormatRange r; QTextLayout::FormatRange r;
QVector<QTextLayout::FormatRange> new_ranges; QVector<QTextLayout::FormatRange> newRanges;
int i = 0; int i = 0;
while (i < formatChanges.count()) { while (i < formatChanges.count()) {
@@ -148,19 +140,19 @@ void SyntaxHighlighterPrivate::applyFormatChanges(int from, int charsRemoved, in
r.length = i - r.start; r.length = i - r.start;
new_ranges << r; newRanges << r;
} }
formatsChanged = formatsChanged || (new_ranges.size() != old_ranges.size()); formatsChanged = formatsChanged || (newRanges.size() != oldRanges.size());
for (int i = 0; !formatsChanged && i < new_ranges.size(); ++i) { for (int i = 0; !formatsChanged && i < newRanges.size(); ++i) {
const QTextLayout::FormatRange &o = old_ranges.at(i); const QTextLayout::FormatRange &o = oldRanges.at(i);
const QTextLayout::FormatRange &n = new_ranges.at(i); const QTextLayout::FormatRange &n = newRanges.at(i);
formatsChanged = (o.start != n.start || o.length != n.length || o.format != n.format); formatsChanged = (o.start != n.start || o.length != n.length || o.format != n.format);
} }
if (formatsChanged) { if (formatsChanged) {
ranges.append(new_ranges); ranges.append(newRanges);
layout->setFormats(ranges); layout->setFormats(ranges);
doc->markContentsDirty(currentBlock.position(), currentBlock.length()); doc->markContentsDirty(currentBlock.position(), currentBlock.length());
} }