Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 49 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,36 @@ on:

jobs:
build:
name: Build (${{ matrix.os }})
name: Build (${{ matrix.os }}, Qt ${{ matrix.qt_version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
qt_version: '5.15.2'
qt_arch: gcc_64
qt_modules: ''
- os: macos-latest
qt_version: '5.15.2'
qt_arch: clang_64
qt_modules: ''
- os: windows-latest
qt_version: '5.15.2'
qt_arch: win64_msvc2019_64
qt_modules: ''
- os: ubuntu-latest
qt_version: '6.8.3'
qt_arch: linux_gcc_64
qt_modules: qt5compat
- os: macos-latest
qt_version: '6.8.3'
qt_arch: clang_64
qt_modules: qt5compat
- os: windows-latest
qt_version: '6.8.3'
qt_arch: win64_msvc2022_64
qt_modules: qt5compat

steps:
- name: Check out source
Expand All @@ -33,39 +51,59 @@ jobs:
if: runner.os == 'Linux'
uses: jurplel/install-qt-action@v4
with:
version: '5.15.2'
version: ${{ matrix.qt_version }}
host: linux
target: desktop
arch: ${{ matrix.qt_arch }}
modules: ${{ matrix.qt_modules }}
install-deps: true
cache: true

- name: Install Qt (macOS)
if: runner.os == 'macOS'
uses: jurplel/install-qt-action@v4
with:
version: '5.15.2'
version: ${{ matrix.qt_version }}
host: mac
target: desktop
arch: ${{ matrix.qt_arch }}
modules: ${{ matrix.qt_modules }}
cache: true

- name: Install Qt (Windows)
if: runner.os == 'Windows'
uses: jurplel/install-qt-action@v4
with:
version: '5.15.2'
version: ${{ matrix.qt_version }}
host: windows
target: desktop
arch: ${{ matrix.qt_arch }}
modules: ${{ matrix.qt_modules }}
cache: true

- name: Set up MSVC
if: runner.os == 'Windows'
- name: Remove obsolete AGL dependency (Qt 6 macOS)
if: runner.os == 'macOS' && startsWith(matrix.qt_version, '6.')
shell: bash
run: |
qt_prefix="$(qmake -query QT_INSTALL_PREFIX)"
find "$qt_prefix" -type f \( -name '*.conf' -o -name '*.prf' -o -name '*.prl' \) \
-exec perl -pi -e 's/-framework AGL//g' {} +
if find "$qt_prefix" -type f \( -name '*.conf' -o -name '*.prf' -o -name '*.prl' \) \
-exec grep -l -- '-framework AGL' {} + | grep -q .; then
echo 'Failed to remove the obsolete AGL framework dependency.' >&2
exit 1
fi

- name: Set up MSVC 2019
if: runner.os == 'Windows' && startsWith(matrix.qt_version, '5.')
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: 14.29

- name: Set up MSVC 2022
if: runner.os == 'Windows' && startsWith(matrix.qt_version, '6.')
uses: ilammy/msvc-dev-cmd@v1

- name: Configure (Linux)
if: runner.os == 'Linux'
shell: bash
Expand All @@ -80,7 +118,11 @@ jobs:
run: |
mkdir -p build-ci
cd build-ci
qmake ../liteidex CONFIG+=release 'QMAKE_LIBS_OPENGL=-framework OpenGL'
qmake_args=(CONFIG+=release 'QMAKE_LIBS_OPENGL=-framework OpenGL')
if [[ '${{ matrix.qt_version }}' == 6.* ]]; then
qmake_args+=('QMAKE_CXXFLAGS+=-include arm_acle.h')
fi
qmake ../liteidex "${qmake_args[@]}"

- name: Configure (Windows)
if: runner.os == 'Windows'
Expand Down
4 changes: 2 additions & 2 deletions liteidex/deploy/welcome/css/style.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
body {
text-align: left;
margin: 0;
font-family: Helvetica, Arial, sans-serif;
font-family: Helvetica, Arial;
}
pre, code {
font-family: Menlo, monospace;
font-family: Menlo;
}
pre .comment {
color: #375EAB;
Expand Down
1 change: 1 addition & 0 deletions liteidex/liteidex.pri
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ isEmpty(IDE_LIBRARY_BASENAME) {
}

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat

DEFINES += LITEAPP_LIBRARY

Expand Down
4 changes: 2 additions & 2 deletions liteidex/src/3rdparty/cplusplus/BackwardsScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ QString BackwardsScanner::text(int index) const
return _text.mid(firstToken.begin(), firstToken.length());
}

QStringRef BackwardsScanner::textRef(int index) const
QStringView BackwardsScanner::textRef(int index) const
{
const Token &firstToken = _tokens.at(index + _offset);
return _text.midRef(firstToken.begin(), firstToken.length());
return QStringView(_text).mid(firstToken.begin(), firstToken.length());
}

int BackwardsScanner::size() const
Expand Down
3 changes: 2 additions & 1 deletion liteidex/src/3rdparty/cplusplus/BackwardsScanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "SimpleLexer.h"

#include <QTextBlock>
#include <QStringView>

QT_FORWARD_DECLARE_CLASS(QTextCursor)

Expand All @@ -56,7 +57,7 @@ class BackwardsScanner
QString mid(int index) const;

QString text(int index) const;
QStringRef textRef(int index) const;
QStringView textRef(int index) const;
// 1-based
Token LA(int index) const;

Expand Down
2 changes: 1 addition & 1 deletion liteidex/src/3rdparty/cplusplus/SimpleLexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ QList<Token> SimpleLexer::operator()(const QString &text, int state)
break;
}

QStringRef spell = text.midRef(lex.tokenOffset(), lex.tokenLength());
QStringView spell(text.constData() + lex.tokenOffset(), lex.tokenLength());
lex.setScanAngleStringLiteralTokens(false);

if (tk.f.newline && tk.is(T_POUND))
Expand Down
3 changes: 2 additions & 1 deletion liteidex/src/3rdparty/diff_match_patch/diff_match_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QtCore>
#include "liteapi/liteqt.h"
#include "diff_match_patch.h"
#include <QRegExp>


//////////////////////////
Expand Down Expand Up @@ -65,7 +66,7 @@ QString Diff::strOperation(Operation op) {
QString Diff::toString() const {
QString prettyText = text;
// Replace linebreaks with Pilcrow signs.
prettyText.replace('\n', L'\u00b6');
prettyText.replace(QLatin1Char('\n'), QChar(0x00b6));
//qDebug(qPrintable(QString("Diff(") + strOperation(operation) + QString(",\"")
// + prettyText + QString("\")")));
return QString("Diff(") + strOperation(operation) + QString(",\"")
Expand Down
63 changes: 39 additions & 24 deletions liteidex/src/3rdparty/fakevim/fakevim/fakevimhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
#include <QPointer>
#include <QProcess>
#include <QRegExp>
#include <QRegularExpression>
#include <QStringRef>
#include <QTextStream>
#include <QTimer>
#include <QStack>
Expand Down Expand Up @@ -426,7 +428,7 @@ static QRegExp vimPatternToQtPattern(QString needle, bool ignoreCaseOption, bool
*/
// FIXME: Option smartcase should be used only if search was typed by user.
bool ignorecase = ignoreCaseOption
&& !(smartCaseOption && needle.contains(QRegExp(_("[A-Z]"))));
&& !(smartCaseOption && needle.contains(QRegularExpression(_("[A-Z]"))));
QString pattern;
pattern.reserve(2 * needle.size());

Expand Down Expand Up @@ -543,6 +545,19 @@ static bool afterEndOfLine(const QTextDocument *doc, int position)
&& doc->findBlock(position).length() > 1;
}

static QTextCursor findRegExp(const QTextDocument *doc, const QRegExp &expression,
const QTextCursor &cursor)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return doc->find(expression, cursor);
#else
QRegularExpression::PatternOptions options = QRegularExpression::NoPatternOption;
if (expression.caseSensitivity() == Qt::CaseInsensitive)
options |= QRegularExpression::CaseInsensitiveOption;
return doc->find(QRegularExpression(expression.pattern(), options), cursor);
#endif
}

static void searchForward(QTextCursor *tc, QRegExp &needleExp, int *repeat)
{
const QTextDocument *doc = tc->document();
Expand All @@ -552,13 +567,13 @@ static void searchForward(QTextCursor *tc, QRegExp &needleExp, int *repeat)
tc->movePosition(StartOfLine);

// forward to current position
*tc = doc->find(needleExp, *tc);
*tc = findRegExp(doc, needleExp, *tc);
while (!tc->isNull() && tc->anchor() < startPos) {
if (!tc->hasSelection())
tc->movePosition(Right);
if (tc->atBlockEnd())
tc->movePosition(NextBlock);
*tc = doc->find(needleExp, *tc);
*tc = findRegExp(doc, needleExp, *tc);
}

if (tc->isNull())
Expand All @@ -571,7 +586,7 @@ static void searchForward(QTextCursor *tc, QRegExp &needleExp, int *repeat)
tc->movePosition(Right);
if (tc->atBlockEnd())
tc->movePosition(NextBlock);
*tc = doc->find(needleExp, *tc);
*tc = findRegExp(doc, needleExp, *tc);
if (tc->isNull())
return;
--*repeat;
Expand All @@ -587,10 +602,10 @@ static void searchBackward(QTextCursor *tc, QRegExp &needleExp, int *repeat)
QTextBlock block = tc->block();
QString line = block.text();

int i = line.indexOf(needleExp, 0);
int i = needleExp.indexIn(line, 0);
while (i != -1 && i < tc->positionInBlock()) {
--*repeat;
i = line.indexOf(needleExp, i + qMax(1, needleExp.matchedLength()));
i = needleExp.indexIn(line, i + qMax(1, needleExp.matchedLength()));
if (i == line.size())
i = -1;
}
Expand All @@ -603,10 +618,10 @@ static void searchBackward(QTextCursor *tc, QRegExp &needleExp, int *repeat)
if (!block.isValid())
break;
line = block.text();
i = line.indexOf(needleExp, 0);
i = needleExp.indexIn(line, 0);
while (i != -1) {
--*repeat;
i = line.indexOf(needleExp, i + qMax(1, needleExp.matchedLength()));
i = needleExp.indexIn(line, i + qMax(1, needleExp.matchedLength()));
if (i == line.size())
i = -1;
}
Expand All @@ -617,9 +632,9 @@ static void searchBackward(QTextCursor *tc, QRegExp &needleExp, int *repeat)
return;
}

i = line.indexOf(needleExp, 0);
i = needleExp.indexIn(line, 0);
while (*repeat < 0) {
i = line.indexOf(needleExp, i + qMax(1, needleExp.matchedLength()));
i = needleExp.indexIn(line, i + qMax(1, needleExp.matchedLength()));
++*repeat;
}
tc->setPosition(block.position() + i);
Expand Down Expand Up @@ -928,7 +943,7 @@ QString quoteUnprintable(const QString &ba)
else if (cc == QLatin1Char('\n'))
res += _("<CR>");
else
res += QString::fromLatin1("\\x%1").arg(c.unicode(), 2, 16, QLatin1Char('0'));
res += QString::fromLatin1("\\x%1").arg(static_cast<uint>(c.unicode()), 2, 16, QLatin1Char('0'));
}
return res;
}
Expand Down Expand Up @@ -1116,7 +1131,7 @@ class Input
return QLatin1Char('\n');
if (m_key == Key_Escape)
return QChar(27);
return m_xkey;
return QChar(m_xkey);
}

QString toString() const
Expand Down Expand Up @@ -1310,7 +1325,7 @@ class CommandBuffer
m_buffer = s; m_pos = m_userPos = pos; m_anchor = anchor >= 0 ? anchor : pos;
}

QStringRef userContents() const { return m_buffer.leftRef(m_userPos); }
QStringRef userContents() const { return QStringRef(&m_buffer, 0, m_userPos); }
const QChar &prompt() const { return m_prompt; }
const QString &contents() const { return m_buffer; }
bool isEmpty() const { return m_buffer.isEmpty(); }
Expand Down Expand Up @@ -2579,7 +2594,7 @@ void FakeVimHandler::Private::commitInsertState()
lastInsertion.prepend(QString(_("<DELETE>")).repeated(insertState.deletes));

// Remove indentation.
lastInsertion.replace(QRegExp(_("(^|\n)[\\t ]+")), _("\\1"));
lastInsertion.replace(QRegularExpression(_("(^|\n)[\\t ]+")), _("\\1"));
}

void FakeVimHandler::Private::invalidateInsertState()
Expand Down Expand Up @@ -2672,8 +2687,8 @@ void FakeVimHandler::Private::importSelection()

void FakeVimHandler::Private::updateEditor()
{
const int charWidth = QFontMetrics(EDITOR(font())).width(QLatin1Char(' '));
EDITOR(setTabStopWidth(charWidth * config(ConfigTabStop).toInt()));
const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(QLatin1Char(' '));
EDITOR(setTabStopDistance(charWidth * config(ConfigTabStop).toInt()));
setupCharClass();
}

Expand All @@ -2683,8 +2698,8 @@ void FakeVimHandler::Private::restoreWidget(int tabSize)
//updateMiniBuffer();
//EDITOR(removeEventFilter(q));
//EDITOR(setReadOnly(m_wasReadOnly));
const int charWidth = QFontMetrics(EDITOR(font())).width(QLatin1Char(' '));
EDITOR(setTabStopWidth(charWidth * tabSize));
const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(QLatin1Char(' '));
EDITOR(setTabStopDistance(charWidth * tabSize));
g.visualMode = NoVisualMode;
// Force "ordinary" cursor.
EDITOR(setOverwriteMode(false));
Expand Down Expand Up @@ -5384,7 +5399,7 @@ bool FakeVimHandler::Private::parseExCommmand(QString *line, ExCommand *cmd)
cmd->cmd = line->mid(0, i).trimmed();

// command arguments starts with first non-letter character
cmd->args = cmd->cmd.section(QRegExp(_("(?=[^a-zA-Z])")), 1);
cmd->args = cmd->cmd.section(QRegularExpression(_("(?=[^a-zA-Z])")), 1);
if (!cmd->args.isEmpty()) {
cmd->cmd.chop(cmd->args.size());
cmd->args = cmd->args.trimmed();
Expand All @@ -5404,7 +5419,7 @@ bool FakeVimHandler::Private::parseExCommmand(QString *line, ExCommand *cmd)
bool FakeVimHandler::Private::parseLineRange(QString *line, ExCommand *cmd)
{
// remove leading colons and spaces
line->remove(QRegExp(_("^\\s*(:+\\s*)*")));
line->remove(QRegularExpression(_("^\\s*(:+\\s*)*")));

// special case ':!...' (use invalid range)
if (line->startsWith(QLatin1Char('!'))) {
Expand Down Expand Up @@ -5463,7 +5478,7 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd)

int count = 1;
QString line = cmd.args;
const int countIndex = line.lastIndexOf(QRegExp(_("\\d+$")));
const int countIndex = line.lastIndexOf(QRegularExpression(_("\\d+$")));
if (countIndex != -1) {
count = line.mid(countIndex).toInt();
line = line.mid(0, countIndex).trimmed();
Expand Down Expand Up @@ -5611,8 +5626,8 @@ bool FakeVimHandler::Private::handleExMapCommand(const ExCommand &cmd0) // :map
break;
}

const QString lhs = args.section(QRegExp(_("\\s+")), 0, 0);
const QString rhs = args.section(QRegExp(_("\\s+")), 1);
const QString lhs = args.section(QRegularExpression(_("\\s+")), 0, 0);
const QString rhs = args.section(QRegularExpression(_("\\s+")), 1);
if ((rhs.isNull() && type != Unmap) || (!rhs.isNull() && type == Unmap)) {
// FIXME: Dump mappings here.
//qDebug() << g.mappings;
Expand Down Expand Up @@ -8244,7 +8259,7 @@ bool FakeVimHandler::Private::changeNumberTextObject(int count)

// convert hexadecimal number to upper-case if last letter was upper-case
if (hex) {
const int lastLetter = num.lastIndexOf(QRegExp(_("[a-fA-F]")));
const int lastLetter = num.lastIndexOf(QRegularExpression(_("[a-fA-F]")));
if (lastLetter != -1 && num[lastLetter].isUpper())
repl = repl.toUpper();
}
Expand Down
Loading
Loading