The TextDocumentManipulatorInterface was introduced to decouple
modification operations from QTextDocument. But nowadays all tests and
production code usages are backed by a QTextDocument, so we can remove
this abstraction layer again. The first step is to merge the interface
and all manipulator implementations.
Change-Id: Idd1609df549d3b120dd516d5161af9aa8aa571ca
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Telling the EditorManager to update the navigation history only really
makes sense in the context of IEditor, not if the widget is used in some
other context.
For this reason the code in the text editor widget also had a check to
only add history in case the current editor's widget is the text editor
widget - which does not work in case of e.g. the Markdown editor or the
Compiler Explorer. Signaling the request for adding navigation points to
the IEditor gives these other editors that integrate text editor(s) a
chance to implement this too.
Change-Id: Id1bb3516519f48a3f4448ac226be21e52bb02b2b
Reviewed-by: David Schulz <david.schulz@qt.io>
When Ctrl+Clicking to follow symbols, the original location was added
twice to the history, once in the click handler, and once when the link
was opened in `TextEditorWidget::openLink`
Change-Id: I806165621d7ea229aa963b5b7d83c5327d8e7f14
Reviewed-by: David Schulz <david.schulz@qt.io>
Only remove more than one character when the cursor is inside the
indentation in the beginning of the line. In all other cases always only
remove one character.
Fixes: QTCREATORBUG-30725
Change-Id: I973101a95768cdd8b1a318972f53423eb72eb157
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Otherwise we also got override action warnings after opening a second
editor.
Change-Id: Id600eaa120e32399a941768ae5d5e35ab969be49
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
The scriptable info is saved to the action registered for a specific context
so we need to add this info to the action builder in the text editor that has the correct context.
Also remove all action builder constructs for the global context that have been registered before
in order to silence the add override action warning.
Change-Id: I631d71ba5eb8e975190713b33827926e868da295
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
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>