Give each editor a context and register editor actions individually for
that context. This removes the need to tell the action handler the
current editor. Additionally all actions are now available in editor
widgets outside of the EditorManager.
Change-Id: I0109866b180889762f8bd8aa07874d8d7c55bfa6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Use an elapsed timer in the syntax highlighter to periodically return
from the highlight and push a continue highlight to the end of the event
loop.
This allows the user to interact with the editor in between those
batches. If the user modifies the document in between highlighting
batches, the area that still needs a rehighlight is increased if needed.
This also reverts 62ea85ee6a and the
related changes.
Task-number: QTCREATORBUG-28727
Change-Id: I7c394dbdff658330bb72f3b68b9928980947db75
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
We want to support more than one back-end in the future.
Task-number: QTCREATORBUG-28116
Change-Id: I72020c94b36072a297e13f44130e5e2482922cd4
Reviewed-by: David Schulz <david.schulz@qt.io>
'_' was handled as a word separator, in contrast the global search did
not. So the user received different results when using find toolbar or
the advanced search while searching with the same option and pattern.
Fixes: QTCREATORBUG-10276
Change-Id: Ie07303fbaa35475bb98bdb813358169474c3ba1d
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
- Made restoreState, ensureBlockIsUnfolded, fold, unfold and unfoldAll
functions to be called only after highlighting is done
- Improved management of foldValidator in async case
- Removed optimizations in cpphighlighter and glshighlighter.
The highlighters are async now and optimization is not necessary.
In these optimizations in the function highlightBlock the highlighting
changes not only for currentBlock but and for several next. Which is
contradict with the function name.
Change-Id: Ib413e6b982eb39d52f36c3066ff0fa8c28fbe231
Reviewed-by: David Schulz <david.schulz@qt.io>
This allows to get back to a 100% font zoom with the keyboard shortcuts
by zooming to an odd zoom factor by other means.
Change-Id: Ie90853367b17c207e9c47fc108b8d6f451e0f838
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
The c'tor of QmlJSEditorFactory allocates QmlJSCompletionAssistProvider
and sets it via setCompletionAssistProvider.
The QbsEditorFactory subclass allocates QbsCompletionAssistProvider
and overrides the previous one via setCompletionAssistProvider.
So, the old one was leaking.
Use std::unique_ptr to ensure the ownership.
Change-Id: I6fb7da2b97c50919e422482c858d3503403b788d
Reviewed-by: David Schulz <david.schulz@qt.io>
It isn't necessary to export the class (which would then best have a d-
pointer etc). Just provide a function that asks the user for a codec and
returns their decision. This makes the whole dialog an implementation
detail.
Change-Id: I7d574561cbe7f079a6d383ba65ba70f6868bbf05
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Since the book mark support is nowadays part of the text editor plugin
we can directly access the bookmark manager from within the editor
without the indirection over the TextEditorPluginPrivate.
Change-Id: I5c04679d6583c06d615d489d3891431adcb64834
Reviewed-by: hjk <hjk@qt.io>
The TextEditor doesn't export its actual toolbar via IEditor::toolBar(),
but an internal container widget. This forces other editors that want to
reuse TextEditorWidget to poke into internal details of TextEditorWidget
if they want to provide the full toolbar including line number button.
By giving access to m_toolBarWidget, other editors like the Markdown
editor can show the full toolbar including line numbers without risking
to break, if TextEditorWidget should refactor its toolbar container.
Task-number: QTCREATORBUG-30166
Change-Id: Ic54f21be1897f00801c6a3cfe29c89131d61e3a5
Reviewed-by: David Schulz <david.schulz@qt.io>
Automatically hide the tooltip of the line column button in the editor
toolbar when the cursor leaves the widget.
Change-Id: Ia17f40029d0821584c8a804b44431a5d7e639066
Reviewed-by: hjk <hjk@qt.io>
New extra widgets for the right side were wrongly inserted between the
buttons for line-ending text-encoding.
Task-number: QTCREATORBUG-30166
Change-Id: I0f55c44344f9586e6aa97da20f5e25c28adf964c
Reviewed-by: David Schulz <david.schulz@qt.io>
When applied to the QPlainTextEdit, the first selection for a range wins.
We want "OtherSelection" which is used for links to win, so we "sort"
it to the beginning of the final list.
Change-Id: Idf84c92ad5bd12d9f6ad6381f7e556e51ee459a9
Reviewed-by: David Schulz <david.schulz@qt.io>
Adds a full copy of KSyntaxHighlighting::Repository class
to the Highlighter class, enabling the relocation of the
Highlighter class to a separate thread. This adjustment ensures
that all Definitions come from the copy of the repository, making
them immutable from external code.
The "reload Definition" function stays supported, as triggering
it results in the recreation of the highlighter for the document,
thereby reconstructing the Repository class.
Change-Id: Id7a4d865228c7e7e20e4770601a3fde55b8a6513
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This change involves the relocation of SyntaxHighlighter processing
to another thread. The core idea is to create a duplicate of the
original TextDocument using SyntaxHighlighterRunnerPrivate::cloneDocument.
A new SyntaxHighlighter is then instantiated by SyntaxHighLighterCreator
for the cloned document. The entire SyntaxHighLighterCreator class is
moved to a new thread, where it performs highlighting on the cloned
document. Upon completion of the highlighting process, the resultsReady
signal is emitted, and the updated highlighting data is applied to the
original document.
This shift of SyntaxHighlighter to another thread enhances the user
experience by preventing UI slowdowns during the highlighting process.
- Introduction of BaseSyntaxHighlighterRunner as an interface class for
future *SyntaxHighlighterRunner.
- Inclusion of DirectSyntaxHighlighterRunner class for performing
highlighting in the main thread, suitable for syntax highlighters
that cannot be moved to another thread.
- Introduction of ThreadedSyntaxHighlighterRunner class for highlighting
in a separate thread, preventing UI blocking during the process.
- Addition of Result data to the SyntaxHighlighter class to facilitate
data exchange between threads.
Task-number: QTCREATORBUG-28727
Change-Id: I4b6a38d15f5ec9b8828055d38d2a0c6f21a657b4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
... in editors displaying a document without a filename.
Change-Id: I857018e2532b406a37983d8fd77e52daa31ae70d
Reviewed-by: David Schulz <david.schulz@qt.io>
- Created HighlighterHelper namespace and static functions
were moved there from the highlighter class
Change-Id: Ib93785a3819317d7c1d5cc480652d4635cb9339b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Added setSyntaxHighlighterCreator function to TextDocument
which allows the creation of highlighters inside TextDocument.
Change-Id: I454f800c878c48a154dad5abd68b7a4f9ceb378a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
The auto fold license header functionality also automatically folds
documentation comments. Automatically collapsing documentation comments
is never correct in the first place so just skip the fold when encounter
a documentation marker in the first comment.
Fixes: QTCREATORBUG-29900
Change-Id: If0dd7842804f3ff0bcd725b54413e9568d5b5ab3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
And make the LineColumnButton independent of IEditor for that (since the
IEditor for the Markdown editor is not a TextEditor.
Change-Id: I52d378ec46d86b1c7928d18f7d39f9726bb6ad23
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
When using the `pressed` signal, the button stays in the "pressed" state
forever afterwards. Using the `clicked` signal behaves correctly, so use
that instead.
Change-Id: I646c93f1db3b1176630f1cfa718aba01d0aaf252
Reviewed-by: David Schulz <david.schulz@qt.io>
This can be used in QmlDesigner to highlight the currently selected
QML object.
Change-Id: I9907d54f767c7d034739d4111a46cd994c961426
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
There is no need to have an extra file for one struct that is only used
inside texteditor.cpp
Change-Id: Iee8f7ce5e0d19da7b444660d81c350eb10b501ef
Reviewed-by: hjk <hjk@qt.io>
Try to get a sensible scope when there is no selection when sorting
lines.
Use the indent level of the current block and select all blocks that are
not empty with the same indent level around that block before sorting
the lines.
Change-Id: I68cbd95f95a0cc4425a0339b992225c3946a6858
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Since Qt 6.5.1 QPlainTextEdit::selectAll emits correctly
cursorPositionChanged on selectAll which calls some multitextcursor
update code on our side. Avoid setting the cursor back to the
QPlainTextEdit in this update code by setting the expected
MultiTextCursor before calling selectAll.
Fixes: QTCREATORBUG-29763
Change-Id: I77f05ac40a9dd126efcd72089a699c908c68da21
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Avoid creating QTextCursors for checking whether a search result is
inside the find scope. QTextCursor::setPosition seems to layout the
block the cursor is positioned at, which is not for free and not needed
to verify whether a search result is inside the find scope.
Change-Id: Ia1658fbbaa89a61f862e0b97eaa5b059972e2311
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Allow to follow to the symbol definition as well as to the type
definition for the symbol under the cursor position.
Change-Id: I8ff50b33a1e739f81b0832b1b28ffc525e1f7177
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Like for the line number label: Having a button instead of a labal makes
it more obvious that there is an action triggered when clicking the
label.
Change-Id: Ied15c05658c0b0b7df75cbcf1704808e94f6985d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>