... 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>
Having a button instead of a labal makes it more obvious that there is
an action triggered when clicking the label.
Also fix the flickering introduced by
f0bb7e8bfa by saving the maximum width of
the sizeHint. Since the width can get big if we have a selection we do
not save the size in that case to avoid blocking the width when the
selection is removed again.
Change-Id: If8210ecbabb8c6449c4f88652fbed99f8526057d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
In 8e118e9d5e, we stopped re-wrapping in
comments when a doxygen/qdoc command appeared at the start of the line.
However, there are also "inline" commands such as \l and \c that can by
chance appear on the start of a line and should not stop rewrapping.
Since we are still quite reluctant to enumerate and categorize the
countless doxygen/qdoc commands, let's just ignore all one-letter
commands for rewrapping purposes.
(Yes, this is another hacky heuristic.)
Fixes: QTCREATORBUG-28761
Change-Id: I40d77706851ec24504d6fd8795906dd55249661d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This change contains various adjustments to the line column label:
- Display the number of selected characters
- Show the number of cursors instead of the position when multiple text
cursors are present in the current editor
- show detailed information for each cursor in the line column tooltip
Fixes: QTCREATORBUG-29381
Change-Id: Ib4f36b290797f1d84f268deeb9556e78ae921c37
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Looking up the last visible block is not for free since it calculates
the bounding rects for all blocks between the first and last visible
block. Avoid one calculation by postponing the annotation cleanup after
the paint event and only if we reach a certain amount of cached entries.
Change-Id: Ibfab49301f82237e16d5a69ce1531539907e7ed8
Reviewed-by: hjk <hjk@qt.io>
Introduce and make use of Utils::insert() for QSet with a return value
that indicates whether insertion actually happened.
Change-Id: I655e4bc3553b74fea5ae8956205e4d8070118d63
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
emitting requestBlockUpdate is not for free so limitting it to blocks
that have changed improve the performance notable for documents with a
lot of refactoring markers.
Change-Id: Ie288a367d1d1d6a9f4359e37ff8486a1dfe36752
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Avoid asking the indenter for the visual indent depth since some
implementations are not cheap and might even cause file io. Fall back to
the default detection.
Change-Id: Ic85d134fc29a0599768ac05c306b8593e83db327
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>