Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into triggerfix
Browse files Browse the repository at this point in the history
  • Loading branch information
smurfix committed Oct 13, 2020
2 parents 6bdbd59 + 51a2df4 commit eb89bd7
Show file tree
Hide file tree
Showing 36 changed files with 2,330 additions and 2,198 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/codeql-analysis.yml
@@ -0,0 +1,98 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [development, main]
schedule:
- cron: '0 7 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['cpp']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
env:
qt: "5.14.1"

steps:
- name: Restore Qt cache
uses: actions/cache@v1
id: cache-qt
with:
path: ${{runner.workspace}}/Qt/${{env.qt}}
key: ${{runner.os}}-qt-${{env.qt}}
restore-keys: |
${{runner.os}}-qt-
- name: Install Qt
uses: jurplel/install-qt-action@v2
if: steps.cache-qt.outputs.cache-hit != 'true'
with:
version: ${{env.qt}}
dir: ${{runner.workspace}}
cached: ${{steps.cache-qt.outputs.cache-hit}}

- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
submodules: true

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: "Set location of vcpkg dependencies"
env:
vcpkgResponseFile: ${{github.workspace}}/3rdparty/our-vcpkg-dependencies/vcpkg-x64-linux-dependencies
run: |
echo "::set-env name=vcpkgResponseFile::$vcpkgResponseFile"
shell: bash

- name: Install apt dependencies
run: |
# Installing packages might fail as the github image becomes outdated
sudo apt update
# These aren't available or don't work well in vcpkg
sudo apt install pkg-config libzip-dev libglu1-mesa-dev libpulse-dev libxkbcommon-x11-0 libqt5x11extras5
# Restore from cache the previously built ports. If "cache miss", then provision vcpkg, install desired ports, finally cache everything for the next run.
- name: Restore from cache and run vcpkg
uses: lukka/run-vcpkg@v2
with:
vcpkgArguments: '@${{env.vcpkgResponseFile}}'
vcpkgDirectory: '${{github.workspace}}/3rdparty/vcpkg'
appendedCacheKey: ${{hashFiles(env.vcpkgResponseFile)}}-newkey

- name: Build Mudlet
uses: lukka/run-cmake@v2
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{github.workspace}}/CMakeLists.txt'
useVcpkgToolchainFile: true
buildDirectory: '${{runner.workspace}}/b/ninja'
cmakeAppendedArgs: --target test -G Ninja -DCMAKE_PREFIX_PATH=${{runner.workspace}}/Qt/${{env.qt}}/gcc_64/

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
16 changes: 0 additions & 16 deletions .github/workflows/whitespace-linter.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CI/appveyor.after_success.ps1
Expand Up @@ -93,7 +93,7 @@ if ("$Env:APPVEYOR_REPO_TAG" -eq "false" -and -Not $Script:PublicTestBuild) {
}

# fails silently if the nupkg file is not found
.\squirrel.windows\tools\Squirrel --releasify $nupkg_path --releaseDir C:\projects\squirreloutput --loadingGif C:\projects\installers\windows\splash-installing-2x.png --no-msi --setupIcon C:\projects\installers\windows\mudlet_main_48px.ico -n "/a /f C:\projects\installers\windows\code-signing-certificate.p12 /p $Env:signing_password /fd sha256 /tr http://timestamp.digicert.com /td sha256"
.\squirrel.windows\tools\Squirrel --releasify $nupkg_path --releaseDir C:\projects\squirreloutput --loadingGif C:\projects\installers\windows\splash-installing-2x.png --no-msi --setupIcon C:\projects\installers\windows\mudlet_main_48px.ico

Write-Output "=== Removing old directory content of release folder ==="
Remove-Item -Recurse -Force $Env:APPVEYOR_BUILD_FOLDER\src\release\*
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindSparkle.cmake
Expand Up @@ -6,7 +6,7 @@ find_path(
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set SPARKLE_FOUND to TRUE if all
# listed variables are TRUE
find_package_handle_standard_args(SPARKLE REQUIRED_VARS SPARKLE_INCLUDE_DIR)
find_package_handle_standard_args(Sparkle REQUIRED_VARS SPARKLE_INCLUDE_DIR)

mark_as_advanced(SPARKLE_INCLUDE_DIR)

Expand Down
7 changes: 3 additions & 4 deletions src/Host.cpp
Expand Up @@ -191,6 +191,7 @@ Host::Host(int port, const QString& hostname, const QString& login, const QStrin
, mAlertOnNewData(true)
, mAllowToSendCommand(true)
, mAutoClearCommandLineAfterSend(false)
, mHighlightHistory(true)
, mBlockScriptCompile(true)
, mBlockStopWatchCreation(true)
, mEchoLuaErrors(false)
Expand Down Expand Up @@ -466,8 +467,7 @@ void Host::saveModules(int sync, bool backup)
QString filename_xml = entry[0];

if (backup) {
// CHECKME: Consider changing datetime spec to more "sortable" "yyyy-MM-dd#HH-mm-ss" (1 of 6)
QString time = QDateTime::currentDateTime().toString("dd-MM-yyyy#hh-mm-ss");
QString time = QDateTime::currentDateTime().toString("yyyy-MM-dd#HH-mm-ss");
savePathDir.rename(filename_xml, savePath + moduleName + time); //move the old file, use the key (module name) as the file
}

Expand Down Expand Up @@ -692,10 +692,9 @@ std::tuple<bool, QString, QString> Host::saveProfile(const QString& saveFolder,
directory_xml = saveFolder;
}

// CHECKME: Consider changing datetime spec to more "sortable" "yyyy-MM-dd#HH-mm-ss" (2 of 6)
QString filename_xml;
if (saveName.isEmpty()) {
filename_xml = QStringLiteral("%1/%2.xml").arg(directory_xml, QDateTime::currentDateTime().toString(QStringLiteral("dd-MM-yyyy#hh-mm-ss")));
filename_xml = QStringLiteral("%1/%2.xml").arg(directory_xml, QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd#HH-mm-ss")));
} else {
filename_xml = QStringLiteral("%1/%2.xml").arg(directory_xml, saveName);
}
Expand Down
1 change: 1 addition & 0 deletions src/Host.h
Expand Up @@ -339,6 +339,7 @@ class Host : public QObject
bool mAlertOnNewData;
bool mAllowToSendCommand;
bool mAutoClearCommandLineAfterSend;
bool mHighlightHistory;
// Set in constructor and used in (bool) TScript::setScript(const QString&)
// to prevent compilation of the script that was being set therein, cleared
// after the main TConsole for a new profile has been created during the
Expand Down
8 changes: 4 additions & 4 deletions src/LuaInterface.cpp
Expand Up @@ -45,7 +45,7 @@ int LuaInterface::onPanic(lua_State* L)
{
QString error = "Lua Panic, No error information";
if (lua_isstring(L, -1)) {
error = QString::fromUtf8(lua_tostring(L, -1));
error = lua_tostring(L, -1);
//there's never anything but the error on the stack, nothing to report
}
//FIXME: report error to user qDebug()<<"PANIC ERROR:"<<error;
Expand Down Expand Up @@ -689,7 +689,7 @@ QString LuaInterface::getValue(TVar* var)
if (vType == LUA_TBOOLEAN) {
value = lua_toboolean(L, -1) == 0 ? QLatin1String("false") : QLatin1String("true");
} else if (vType == LUA_TNUMBER || vType == LUA_TSTRING) {
value = QString::fromUtf8(lua_tostring(L, -1));
value = lua_tostring(L, -1);
}
lua_pop(L, pCount);
return value;
Expand All @@ -712,7 +712,7 @@ void LuaInterface::iterateTable(lua_State* L, int index, TVar* tVar, bool hide)
lrefs.append(keyName.toInt());
var->setReference(true);
} else {
keyName = QString::fromUtf8(lua_tostring(L, -1));
keyName = lua_tostring(L, -1);
if (kType == LUA_TFUNCTION && keyName.isEmpty()) {
//we lost the reference
keyName = QString::number(luaL_ref(L, LUA_REGISTRYINDEX));
Expand Down Expand Up @@ -758,7 +758,7 @@ void LuaInterface::iterateTable(lua_State* L, int index, TVar* tVar, bool hide)
}
} else if (vType == LUA_TSTRING || vType == LUA_TNUMBER) {
lua_pushvalue(L, -1);
valueName = QString::fromUtf8(lua_tostring(L, -1));
valueName = lua_tostring(L, -1);
var->setValue(valueName);
lua_pop(L, 1);
} else if (vType == LUA_TBOOLEAN) {
Expand Down
2 changes: 1 addition & 1 deletion src/MxpTag.h
Expand Up @@ -33,7 +33,7 @@ class MxpTagAttribute : public QPair<QString, QString>

MxpTagAttribute(const QString& name, const QString& value) : QPair(name, value) {}

explicit MxpTagAttribute(const QString& name) : MxpTagAttribute(name, QString::fromLatin1("")) {}
explicit MxpTagAttribute(const QString& name) : MxpTagAttribute(name, QString()) {}

MxpTagAttribute() : QPair() {}

Expand Down
6 changes: 3 additions & 3 deletions src/TBuffer.cpp
Expand Up @@ -3525,7 +3525,7 @@ bool TBuffer::processUtf8Sequence(const std::string& bufferData, const bool isFr
for (size_t i = 0; i < utf8SequenceLength; ++i) {
debugMsg.append(QStringLiteral("<%1>").arg(static_cast<quint8>(bufferData.at(pos + i)), 2, 16, QChar('0')));
}
qDebug().nospace() << " Sequence bytes are: " << debugMsg.toLatin1().constData();
qDebug().nospace() << " Sequence bytes are: " << debugMsg;
#endif
if (isToUseReplacementMark) {
mMudLine.append(QChar::ReplacementCharacter);
Expand Down Expand Up @@ -3968,7 +3968,7 @@ bool TBuffer::processGBSequence(const std::string& bufferData, const bool isFrom
for (size_t i = 0; i < gbSequenceLength; ++i) {
debugMsg.append(QStringLiteral("<%1>").arg(static_cast<quint8>(bufferData.at(pos + i)), 2, 16, QChar('0')));
}
qDebug().nospace() << " Sequence bytes are: " << debugMsg.toLatin1().constData();
qDebug().nospace() << " Sequence bytes are: " << debugMsg;
#endif
if (isToUseReplacementMark) {
mMudLine.append(QChar::ReplacementCharacter);
Expand Down Expand Up @@ -4093,7 +4093,7 @@ bool TBuffer::processBig5Sequence(const std::string& bufferData, const bool isFr
for (size_t i = 0; i < big5SequenceLength; ++i) {
debugMsg.append(QStringLiteral("<%1>").arg(static_cast<quint8>(bufferData.at(pos + i)), 2, 16, QChar('0')));
}
qDebug().nospace() << " Invalid. Sequence bytes are: " << debugMsg.toLatin1().constData();
qDebug().nospace() << " Invalid. Sequence bytes are: " << debugMsg;
#endif
if (isToUseReplacementMark) {
mMudLine.append(QChar::ReplacementCharacter);
Expand Down
11 changes: 9 additions & 2 deletions src/TCommandLine.cpp
Expand Up @@ -279,6 +279,7 @@ bool TCommandLine::event(QEvent* event)
mpConsole->mLowerPane->hide();
mpConsole->buffer.mCursorY = mpConsole->buffer.size();
mpConsole->mUpperPane->mCursorY = mpConsole->buffer.size();
mpConsole->mUpperPane->mCursorX = 0;
mpConsole->mUpperPane->mIsTailMode = true;
mpConsole->mUpperPane->updateScreenView();
mpConsole->mUpperPane->forceUpdate();
Expand Down Expand Up @@ -372,6 +373,9 @@ bool TCommandLine::event(QEvent* event)
// If EXACTLY Down is pressed without modifiers (special case
// for macOs - also sets KeyPad modifier)
historyDown(ke);
if (!mpHost->mHighlightHistory){
moveCursor(QTextCursor::End);
}
ke->accept();
return true;

Expand Down Expand Up @@ -406,6 +410,9 @@ bool TCommandLine::event(QEvent* event)
// If EXACTLY Up is pressed without modifiers (special case for
// macOs - also sets KeyPad modifier)
historyUp(ke);
if (!mpHost->mHighlightHistory){
moveCursor(QTextCursor::End);
}
ke->accept();
return true;

Expand Down Expand Up @@ -1017,7 +1024,7 @@ void TCommandLine::historyDown(QKeyEvent* event)
if (mHistoryList.empty()) {
return;
}
if ((textCursor().selectedText().size() == toPlainText().size()) || (toPlainText().size() == 0)) {
if ((textCursor().selectedText().size() == toPlainText().size()) || (toPlainText().size() == 0) || !mpHost->mHighlightHistory) {
mHistoryBuffer--;
if (mHistoryBuffer >= mHistoryList.size()) {
mHistoryBuffer = mHistoryList.size() - 1;
Expand All @@ -1043,7 +1050,7 @@ void TCommandLine::historyUp(QKeyEvent* event)
if (mHistoryList.empty()) {
return;
}
if ((textCursor().selectedText().size() == toPlainText().size()) || (toPlainText().size() == 0)) {
if ((textCursor().selectedText().size() == toPlainText().size()) || (toPlainText().size() == 0) || !mpHost->mHighlightHistory) {
if (toPlainText().size() != 0) {
mHistoryBuffer++;
}
Expand Down

0 comments on commit eb89bd7

Please sign in to comment.