aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/generichighlighter
Commit message (Collapse)AuthorAgeFilesLines
* TextEditor: replace generic highlighter with ksyntaxhighlightingDavid Schulz2019-01-2837-6241/+0
| | | | | | Fixes: QTCREATORBUG-21029 Change-Id: I9894c4384e0e47da6bf030b7b8e07c3ad4737ff3 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* TextEditor: ModernizeAlessandro Portale2018-11-3010-68/+53
| | | | | | | | modernize-* Change-Id: Ic497fea1942a77cf017be3b0033f92e3807066f1 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: hjk <hjk@qt.io>
* Fix infinite recursion in highlight processorDaniel Levin2018-11-083-0/+26
| | | | | | | | | | | | | | | | | | | | | | | Highlight definitions might have a case with recursive context call. Trivial example: <context name="foo" fallthroughContext="bar"> <context name="bar" fallthroughContext="#pop"> This leads to infinite recursion call or infinite while loop in Highlighter::highlightBlock. Some safety measures should be implemented, like Kate does. Implementation should detect recursion call and stop processing current line. I.e. when iterateThroughRules() was already called with exactly the same current context and progress->offset(). This patch implements recursion detection in ProgressData instance. Task-number: QTCREATORBUG-21411 Change-Id: I4e1ba13ce40b7ba0f64ec655f8ce4b6e406ccf97 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: David Schulz <david.schulz@qt.io>
* TextEditor: ModernizeOrgad Shaneh2018-09-2012-134/+93
| | | | | | | override, auto, nullptr, member initializers. Change-Id: I04c6ebb683849568973bd7782fb5a3279267141e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* TextEditor: Pass dialogParent where neededOrgad Shaneh2018-09-201-3/+4
| | | | | Change-Id: I57c41d0e8e37472a1a5070ea082b4c2e1ff6d287 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Avoid accessing global font settings from syntax highlightersEike Ziller2018-09-191-1/+1
| | | | | | Change-Id: Ic015f7449351166ec41a7745355ddc63504f6442 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: David Schulz <david.schulz@qt.io>
* Fix painting of current line in generic and python editorsEike Ziller2018-08-241-5/+7
| | | | | | | | | | | | | | | | | The generic highlighter and the python editor explicitly map some tokens to the format C_TEXT. Unfortunately this format is special, because it's foreground and background colors are handled by setting the editor's palette, and should not be used for setting the format on characters. If the format is explicitly set on characters, their background will be oblique and overpaint e.g. the highlight for the current line, which looks pretty ugly. Handle this directly in SyntaxHighlighter::formatForCategory for all syntax highlighters, by returning an empty QTextCharFormat for C_TEXT. Change-Id: Ifaeb556754ca8106ad6e55d7062b13b45457a809 Reviewed-by: David Schulz <david.schulz@qt.io>
* TextEditor: Fix compile on macOSChristian Stenger2018-08-151-0/+2
| | | | | Change-Id: I78929b2d3f6e7803879e63ba5611e5210cc53f90 Reviewed-by: David Schulz <david.schulz@qt.io>
* GenericHighlighter: check text color against backgroundDavid Schulz2018-08-141-1/+41
| | | | | | | | | | | | | The kate syntax highlighter format allows to directly assign a color for a specific item. This could result in a bad contrast ratio between text and background. Check the contrast ratio according to W3C Recommendation and apply if it exceeds the minimum contrast ratio for large text. (https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast- contrast) Task-number: QTCREATORBUG-20919 Change-Id: If5a5d09224446df72f31027cd30e50088179d6d7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* GenericHighlighter: Support WordDetectOrgad Shaneh2018-07-024-2/+40
| | | | | | | | | | | | Added in Kate 3.5 (KDE 4.5). Similar to StringDetect, but only matches whole word (\b<string>\b) Already used in some of the built-in highlighters. Change-Id: I03ae5e1db917e777a21bb96d9a31cc7771287f39 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* Fix compilation issues with C++17Eike Ziller2018-06-051-2/+6
| | | | | | | | | | | | | | | | | | Testable on Linux/macOS by changing c++14 to c++1z in qtcreator.pri. Testable with latest MSVC2017 by setting _CL_=/std:c++17. unary_function, binary_function, and a few other things that were deprecated are removed in C++17. std::string got a non-const overload for its "data" member function, so we cannot create a function pointer on it without specifying its type. Use std::declval instead (though it requires a default constructor for the type). MSVC seems to have an issue with Utils::transform for std::vector (used in Nim plugin), but that looks like a compiler issue. Change-Id: I94f9a93d591d55b610f86fabfc618158927d6221 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* TextEditor: Consistently use nullptrTobias Hunger2018-05-081-1/+1
| | | | | | | Fixed by clang-tidy modernize-use-nullptr. Change-Id: I7170c4cb1eef0aa5cd2b10d626ebcae38090a713 Reviewed-by: David Schulz <david.schulz@qt.io>
* TextEditor: Use override consistentlyTobias Hunger2018-05-083-7/+7
| | | | | | | clang-tidy fixes from modernize-use-override check. Change-Id: Ie98c08279d7bf01f2705f631500dcabac5ba85d1 Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge remote-tracking branch 'origin/4.6'Eike Ziller2018-04-132-1/+9
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/utils/settingsaccessor.cpp src/plugins/autotest/autotestplugin.cpp src/plugins/git/gitclient.cpp src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp src/plugins/qbsprojectmanager/qbsrunconfiguration.h Change-Id: I65f143cad18af509a2621d6c5925abbd038ea70f
| * Highlighter: fix crash after closing fileDavid Schulz2018-04-132-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | Regular expression rules are tracked inside the progress data to inform the rule about a finished highlighting process. A cloned rule was not properly tracked. That results in a rule that tries to untrack itself on destruction after the progress data has already been deleted. Task-number: QTCREATORBUG-20247 Change-Id: I007e7afbc16706bc28f89faf91c0b1c5f0bc692a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Don't translate default windowTitle again and againRobert Loehning2018-03-061-1/+1
|/ | | | | Change-Id: I4b4ff16e02c517bcd5a7c5ae73f62dd2a5bcc7cc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* GenericHighlighter: Update definitions urlOrgad Shaneh2018-02-281-1/+1
| | | | | Change-Id: I0411354aa89f08bde65c96a71ebc2e5deae34eae Reviewed-by: David Schulz <david.schulz@qt.io>
* Highlighter: fix crash after context changeDavid Schulz2018-02-285-7/+26
| | | | | | | | | | | Context changes might delete rules. Make sure to not dereference these deleted rules by: - save needed rule information before context change - untrack every rule in ProgressData that was deleted Task-number: QTCREATORBUG-19916 Change-Id: Icdbb739c1030bf918dbbe6c3a540a7c8893ce5a9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* TextEditor: Clean forward declarationLaurent Montel2017-09-281-1/+0
| | | | | Change-Id: If338617551893e3ce3c7a68ff1abfc60de8cf610 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Fix string messagesJarek Kobus2017-09-112-3/+5
| | | | | | | | | Found during translating. Change-Id: I9626b3393d7b53300f7c806acbc5e12bc58574d2 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Merge remote-tracking branch 'origin/4.4'Eike Ziller2017-07-252-0/+15
|\ | | | | | | | | | | | | Conflicts: qtcreator.pri Change-Id: If5f4a9821a23ac0df81eb84b3980f9cf7ecd70ba
| * GenericHighlighter: Update supported kate stylesDavid Schulz2017-07-252-0/+15
| | | | | | | | | | Change-Id: I016b25c56b31c615e208e86e690fc7408c9e5384 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | TextEditor: Initialize some membersTobias Hunger2017-07-201-7/+6
|/ | | | | | | Coverity was complaining about these, in some places even rightly so:-) Change-Id: Ia85cdd2c74f05edba6f0d4534aa9f2ee2a750595 Reviewed-by: David Schulz <david.schulz@qt.io>
* SyntaxHighligher: Remove the need to specify format for spacesEike Ziller2017-05-232-3/+1
| | | | | | | It has all means to know itself. Change-Id: I464c195c5ee47e5fc58414a280c166e4a332c588 Reviewed-by: David Schulz <david.schulz@qt.io>
* Simplify text format handling in syntax highlightersEike Ziller2017-05-232-33/+44
| | | | | | | | | | | | | | | | Pass the mapping from custom enum to text style in form of a function, which then can use a switch which is checked by compilers, and avoids the need to lookup a different enum somewhere else to find out what the mapping actually is. That mapping is cached to keep performance as before. Also, most highlighters created an enum just for the purpose of mapping to text styles, basically creating duplicated subsets of text style like enums everywhere. Instead provide a default, identity mapping from text styles to text styles. Change-Id: I2ea1ca702b99e36b8742dfda510b1b2753f0a1c2 Reviewed-by: David Schulz <david.schulz@qt.io>
* Highlighter: Fix freezing highlighter for complex context switchesDavid Schulz2017-05-051-4/+11
| | | | | | | | | | | | Exclamation marks in context attributes are used to split the attribute into a number of orders and an identifier. This identifier is the context that have to be set after executing the orders. Ignoring this context identifier could lead to an endless loop if used inside a default context with a Rule that has set the lookAhead attribute. Task-number: QTCREATORBUG-14611 Change-Id: I5992fa47ed2e353cbf7882bc772fdbee8f7f41f1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Editor: Fix crash in generic Highlighter for invalid rulesDavid Schulz2017-03-081-0/+3
| | | | | | Change-Id: I3da9115ecd54f72256e4ee399b2cd37e31f6bcbe Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Utils: Wrap MimeDatabase into static functionshjk2017-03-031-2/+1
| | | | | | | | To avoid repeating the 'MimeDatabase mdb; mdb.something(); ' mantra all over the place. Change-Id: I4bfef62e73275a991455141671d6071162788e9d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Convert some 0 to nullptrMontel Laurent2017-02-231-1/+1
| | | | | Change-Id: Ib3ca8e2cc0d63fd35582c73b3cf7c915fb64ddfb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* TextEditor: Fix missing includeChristian Stenger2017-02-171-0/+1
| | | | | Change-Id: Id93ec7fce863a2307bee7ff53e442b09dac87da6 Reviewed-by: David Schulz <david.schulz@qt.io>
* GenericHighlighter: Handle invalid keyword list referencesOrgad Shaneh2017-02-171-1/+11
| | | | | | | | makefile.xml has bmake_var_modifiers_noarg and bmake_var_modifiers_with_arg which are not defined. Change-Id: Ice5bcaf86e7dbe90d4e9b2c52babbc62f9491e05 Reviewed-by: David Schulz <david.schulz@qt.io>
* GenericHighlighter: Update from KSyntaxHighlightingOrgad Shaneh2017-01-171-1/+1
| | | | | | Change-Id: I2fdf7f48494e2de3ef8ec64260c4f194ab5f959d Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
* Use QString::splitRef() instead of QString::split()Friedemann Kleint2016-11-251-2/+2
| | | | | | | Avoid string allocation where it seems feasible. Change-Id: I61b23d4ef8a459f5aa77727a75f4e1d2b140da3b Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* improve static initializersTim Jenssen2016-09-231-31/+30
| | | | | Change-Id: I304fdd6627f01fc216c84930da607127c52409d9 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Highlighter: Handle lineEmptyContext in generic highlighterDavid Schulz2016-09-124-1/+20
| | | | | | Task-number: QTCREATORBUG-16304 Change-Id: I8202bcb9cbebac5913d49e39011eb00f909aa4ad Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* UI files: Fix tab order in lots of UI formsNazar Gerasymchuk2016-08-021-0/+1
| | | | | | | | | | For unknown reasons tab order in listed UI files was set incorrectly and behave unexpectedly. Now tab order behave naturally. Changes made for listed objects and touches only UI. Change-Id: I057b95eb21943ddb29b108682618382661db7be9 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* GenericHighlighter: Support dsDocumentationOrgad Shaneh2016-07-222-2/+5
| | | | | | | Use doxygen style for that Change-Id: Ic1f9c557e2bfa21bb9543448a4f12413ff7bff4d Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* SynchronousProcess: Store raw bytes from stdout/stderr of the processTobias Hunger2016-07-151-1/+1
| | | | | | | | | | | | | | | Only convert the raw output later in a stdOut() and stdErr() method of the SynchronousProcessResponse. This is necessary since we have processes that use different encodings for different sections of the file (I am looking at you, git). Also remove the signals for raw data on stdout/stderr, leaving only the signals returning buffered QString lines. This should be safe, even with UTF-16 output. Change-Id: Ida613fa86d1468cbd33bc6b3a1506a849c2d1c0a Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Use SynchronousProcess::runBlockingTobias Hunger2016-05-261-1/+1
| | | | | | | | | | | | | Use SynchronousProcess::runBlocking in favor of SychronousProcess::run. This avoid nested event loops which can produce really strange crashes if not use carefully. This patch only converts those processes that have a timeout of less than 5 seconds or use the default timeout. Change-Id: I9de8899dcc946af7049ea357a91972996c0256a1 Reviewed-by: Vikas Pachdha <vikas.pachdha@theqtcompany.com> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Fix up QProcess::waitForFinished()Tobias Hunger2016-05-111-6/+7
| | | | | | | | waitForFinish returns false if the process is no longer running at the time of the call. Handle that throughout the codebase. Change-Id: Ia7194095454e82efbd4eb88f2d55926bdd09e094 Reviewed-by: hjk <hjk@theqtcompany.com>
* GenericHighlighter: Use new Utils::map for downloading definitionsEike Ziller2016-04-292-13/+2
| | | | | | | Gets rid of the dummy callable object for QtConcurrent::map. Change-Id: I306b238ed72f798b88c859e76def3f97c8ee1582 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* Generic Highlighter: Use dialogParent for error dialog.Eike Ziller2016-04-291-1/+1
| | | | | Change-Id: I58c8326cef7b26e433cd259d457fed6eb7dd59c0 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* Merge remote-tracking branch 'origin/4.0'Eike Ziller2016-04-151-4/+4
|\ | | | | | | Change-Id: Ied609608f6b12aa923c67777bc5a273c4d8fbcbb
| * Generic Highlighter: Remove warnings and thread safety issuesEike Ziller2016-04-131-4/+4
| | | | | | | | | | | | | | | | | | QNetworkAccessManager is not thread safe, and creates child objects that need to live in the same thread as the manager, so we need to create one network access manager per thread. Change-Id: I76b8a3cb8a7c7665bc6a5f3d49496096903eeb87 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* | Merge remote-tracking branch 'origin/4.0'Eike Ziller2016-04-052-31/+18
|\| | | | | | | | | | | | | Conflicts: src/libs/utils/tcpportsgatherer.h Change-Id: I495f3e05789f09efb8b1e84827893423a5b5b60c
| * Runextensions/hasCallOperator: Fix build with MSVC2015 Update 2Eike Ziller2016-04-052-30/+17
| | | | | | | | | | | | | | | | | | | | | | | | Looks like MSVC has issues (internal compiler error) with the "templates in templates" when used from within a namespace, as well as a few other problems... Simplify the code paths for hasCallOperator. Change-Id: I934401a884398967ac95d7e218525cc316d9000a Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
| * TextEditor: Fix URL for highlight definitionsChristian Stenger2016-04-041-1/+1
| | | | | | | | | | | | Task-number: QTCREATORBUG-15997 Change-Id: Ibd90a8cdcf01892768b8a7fcbec7735d10d7b65c Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* | Wholesale conversion to #pragma oncehjk2016-03-3019-76/+19
|/ | | | | | | Kudos to cgmb and https://github.com/cgmb/guardonce Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* GenericHighlighter: Support new default stylesOrgad Shaneh2016-03-142-0/+33
| | | | | | | | Introduced in KTextEditor commit f80e12bedca0d8f682aebc450d1b6d66550010ce (version 4.100, 2014 Mar). Change-Id: Ib3614077b3bf5f4254266ec79d0abdbb486fd685 Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
* GenericHighlighter: Annotate styles for formatsOrgad Shaneh2016-03-141-17/+17
| | | | | | | And reorder the IDs insertions by the enum order. Change-Id: Idad8e8635772eacbb54b15d78dcd9ab93618fbba Reviewed-by: David Schulz <david.schulz@theqtcompany.com>