author | Antonio Rojas
<arojas@archlinux.org> 2016-05-29 16:24:26 UTC |
committer | Antonio Rojas
<arojas@archlinux.org> 2016-05-29 16:24:26 UTC |
parent | 70ee3da6b143a8e6386a5365db6f4d9e69d851d2 |
PKGBUILD | +8 | -3 |
kdebug-363297.patch | +103 | -0 |
diff --git a/PKGBUILD b/PKGBUILD index 3af1cbe..9463c25 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -6,16 +6,21 @@ pkgbase=kate pkgname=('kwrite' 'kate') pkgver=16.04.1 -pkgrel=1 +pkgrel=2 arch=('i686' 'x86_64') license=('GPL' 'LGPL' 'FDL') makedepends=('extra-cmake-modules' 'kdoctools' 'python' 'plasma-framework' 'knewstuff' 'ktexteditor' 'threadweaver' 'kitemmodels' 'kactivities') -source=("http://download.kde.org/stable/applications/${pkgver}/src/${pkgbase}-${pkgver}.tar.xz") -sha1sums=('ba9a31b7293f9b31f55090287804a8d0e9196a36') +source=("http://download.kde.org/stable/applications/${pkgver}/src/${pkgbase}-${pkgver}.tar.xz" kdebug-363297.patch) +sha1sums=('ba9a31b7293f9b31f55090287804a8d0e9196a36' + '1efebf617f8407a5b2d58338ea8860fbe86cdf90') prepare() { mkdir -p build + +# Fix opening file:// url's http://bugs.kde.org/show_bug.cgi?id=363297 + cd $pkgbase-$pkgver + patch -p1 -i ../kdebug-363297.patch } build() { diff --git a/kdebug-363297.patch b/kdebug-363297.patch new file mode 100644 index 0000000..2bcf9f6 --- /dev/null +++ b/kdebug-363297.patch @@ -0,0 +1,103 @@ +--- a/urlinfo.h.orig 2016-04-30 21:08:20.000000000 +0000 ++++ b/urlinfo.h 2016-05-29 16:12:59.684139033 +0000 +@@ -25,38 +25,79 @@ + #include <QRegularExpression> + #include <QString> + +-// Represents a file to be opened, consisting of its URL and the cursor to jump to. +-struct UrlInfo ++/** ++ * Represents a file to be opened, consisting of its URL and the cursor to jump to. ++ */ ++class UrlInfo + { +- // Parses a file path argument and determines its line number and column and full path ++public: ++ /** ++ * Parses a file path argument and determines its line number and column and full path ++ * @param path path passed on e.g. command line to parse into an URL ++ */ + UrlInfo(QString path) + : cursor(KTextEditor::Cursor::invalid()) + { +- // convert to an url +- const QRegularExpression withProtocol(QStringLiteral("^[a-zA-Z]+://")); // TODO: remove after Qt supports this on its own +- if (withProtocol.match(path).hasMatch()) { +- url = QUrl::fromUserInput(path); +- } else { ++ /** ++ * construct url: ++ * - make relative paths absolute using the current working directory ++ * - prefer local file, if in doubt! ++ */ ++ url = QUrl::fromUserInput(path, QDir::currentPath(), QUrl::AssumeLocalFile); ++ ++ /** ++ * in some cases, this will fail, e.g. if you have line/column specs like test.c:10:1 ++ * => fallback: assume a local file and just convert it to an url ++ */ ++ if (!url.isValid()) { ++ /** ++ * create absolute file path, we will e.g. pass this over dbus to other processes ++ */ + url = QUrl::fromLocalFile(QDir::current().absoluteFilePath(path)); + } + +- if (url.isLocalFile() && !QFile::exists(path)) { +- // Allow opening specific lines in documents, like mydoc.cpp:10 +- // also supports columns, i.e. mydoc.cpp:10:42 +- static const QRegularExpression pattern(QStringLiteral(":(\\d+)(?::(\\d+))?$")); +- const auto match = pattern.match(path); +- if (match.isValid()) { +- path.chop(match.capturedLength()); +- int line = match.captured(1).toInt() - 1; +- // don't use an invalid column when the line is valid +- int column = qMax(0, match.captured(2).toInt() - 1); +- url = QUrl::fromLocalFile(QDir::current().absoluteFilePath(path)); +- cursor = {line, column}; +- } ++ /** ++ * Allow opening specific lines in documents, like mydoc.cpp:10 ++ * also supports columns, i.e. mydoc.cpp:10:42 ++ * ignores trailing colons, as compile errors often use that format ++ */ ++ if (url.isLocalFile() && !QFile::exists(url.toLocalFile())) { ++ /** ++ * update path from url, might have been file://... ++ */ ++ path = url.toLocalFile(); ++ ++ /** ++ * try to match the line/colum spec, else we are done here ++ */ ++ const auto match = QRegularExpression(QStringLiteral(":(\\d+)(?::(\\d+))?:?$")).match(path); ++ if (!match.isValid()) ++ return; ++ ++ /** ++ * cut away the line/column specification from the path and update the url ++ */ ++ path.chop(match.capturedLength()); ++ url = QUrl::fromLocalFile(path); ++ ++ /** ++ * set right cursor position ++ */ ++ int line = match.captured(1).toInt() - 1; ++ // don't use an invalid column when the line is valid ++ int column = qMax(0, match.captured(2).toInt() - 1); ++ cursor = {line, column}; + } + } + ++ /** ++ * url computed out of the passed path ++ */ + QUrl url; ++ ++ /** ++ * initial cursor position, if any found inside the path as line/colum specification at the end ++ */ + KTextEditor::Cursor cursor; + }; +