Only update the changed blocks and use sets instead of lists to
store the info and create the diff.
Change-Id: I08d81b326ceebdc6bf2ba322886b7bf5671b2769
Reviewed-by: David Schulz <david.schulz@qt.io>
Since the find of QTextDocument is line based, it is not possible to
find selections spanning multiple lines in the editor. Triggering a find
on a search term containing a paragraph separator returnes an invalid
QTextCursor which always result in searching from the beginning of the
document in the add cursor for selection logic. Prevent that by checking
the selected text beforehand and add a safety net in the loop to verify
that we do not start over again on an invalid TextCursor.
Fixes: QTCREATORBUG-28709
Change-Id: I8c1b9d16e707fefbba6dc0a0a9ef21b8c82ebe19
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
The hiding is not persistent, so on the next Qt Creator start all
annotations are visible again. This is meant to quickly get rid of
annotations if there are to many irrelevant of a specific kind.
Change-Id: I4862e56e0f5624f30aadda26efc9dea672ab1f57
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...
While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only
Change was done by running
find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;
Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reduce the alpha of the marker if a cursor is at the same position as
the marker.
Fixes: QTCREATORBUG-28645
Change-Id: I01b1825fd3f393dcc75cc58d64a31f22e50e2648
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Checking whether a position is inside the first line is also not for
free. Only check the line number of a cursor position if we expect the
editor to have multiple lines per block or in other words line wrapping is
enabled.
Change-Id: I0e3cb1fbd11c250677f7c11d1a5c780f60085ec2
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
QTextLines cursorToX indirectly calls shapeText which is not for free.
We just want to have the x position for the line so there is no need to
shape the complete text to get the position of the first cursor.
Change-Id: I0ae636ed8250385b7ac77c6f37d45922bbf2e9bf
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
It was possible to get a tooltip with cached text from other editor area
Fixes: QTCREATORBUG-28571
Change-Id: I4250856e6c165eed70ddb4a6c888e16b4a6b045d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Detected by clazy analyzer. The possible context was
TextEditorWidget::dropEvent(). In some branches we ensure
that mime is not null, but later we call insertFromMimeData()
unconditionally.
Change-Id: Iee5138bc19d405050eafc9617d3c2ed123b767c7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Otherwise some overrides of extraAreaWidth() may leave passed
value unmodified and we may end up with uninitialized value.
Change-Id: Ica89019fc2cff93f0bc7d784624730ec9d8c0224
Reviewed-by: David Schulz <david.schulz@qt.io>
This way the base class can manage the lifetime of the interface object
and it doesn't need to be done in each implementation of perform.
Change-Id: Ie1ce742e31b688a337533ee6c57d376146e25ace
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
A code assistant is not usable without a text editor widget and is
always created as part of one, so make the dependency obvious by require
it in the construction of the code assistant. This removes a bunch of
functions and cheks.
Change-Id: I96556430082ff729d99d2ae2516599f9b8cbc704
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
If the rectangle of an annotation changes we need to completely redraw
the annotation since the content might have shifted and the eliding
character is now at a different position.
Fixes: QTCREATORBUG-28411
Change-Id: I41b0f38a73b287e6a5d5318ba797aac6e2ff71b0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Text editors need to know the actual mimetype of a file to be able to
open the correct editor view. Just checking the extension is not
enough. Especially on linux there are many text files without
an extension.
Change-Id: I7e5c935b0619f5d86e97f10bfd7ff9b65da62f4b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Do not add the find usage action to an editor context menu if it is
already there.
Change-Id: I0a98d81ae0e08be69ca2579af5701b5fbc8ccbda
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Take m_visibleIndentOffset into account when drawing
right margin.
Fixes: QTCREATORBUG-26601
Change-Id: I50839098953181c667a5fe0e5fac7dfa5bc95327
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
Do not missinterpret the new block count after a document change as the
requested extra area width.
Fixes: QTCREATORBUG-27267
Change-Id: Id724f68d223741bc36e4566e51e5d1d051f6cca3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Use the indenter based visual indent only for the cpp qt style indenter
since it gives accurate results. In all other casess Look for the next
and previous not empty lines and use the minimum indent depth of those
lines as the visual indent depth for empty lines.
Task-number: QTCREATORBUG-28179
Change-Id: Ic456fba5adfb2a12f20e2bd4fc663010c752b65c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
Do not try to find the first none space character of a block if we
already handled the home key for a line that does not contain the start
of the block.
Fixes: QTCREATORBUG-28198
Change-Id: Ia2966baeae8f068cd21d716e097782ae3b5a1d86
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This fixes saving documents and copy texts that contain non breaking
spaces.
Task-number: QTCREATORBUG-17875
Change-Id: Ie0b0e68cf7d67e768ff99c9acae1937aafc78ce7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Moving all initializations that are not influenced by the document to
the TextEditorWidget(Private) constructor. So we do not reinitialize or
double connect unintendedly.
Change-Id: I42f4e8166c21aec9c8b780033b12eb8dae5f72a6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
After setting the document the display settings that are configured in a
widget might differ from the ones configured in the document. So Check
those values against the desired values from the editor and update if
they differ.
Change-Id: I30c5eddbb09803451fe03769d8e6d189293c5e86
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
The crash happens when calling TextEditorWidget::setTextDocument()
second time for the same editor instance.
Change-Id: I0a2febb50702673e2751a0d41fc0bc80cb6ba4a2
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
... of the generic text editor if the editor has the FindUsage optional
action mask set. This is mainly used to show this action when a language
server is configured for this editor that supports find usages.
Change-Id: I55c6983cd553c46817332144f78f1207185ac3f6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... in rewrapParagraph().
One could argue that this functionality is only for pure text and should
not be used on code, but since it was apparently contributed with
doxygen in mind, we might as well go out of our way a bit to support it
a little better.
The simple approach here is to treat a doxygen command at the start of a
line as the end of the reflow region.
Fixes: QTCREATORBUG-9739
Change-Id: I5affee9c441bd9e862bdaf38930fcf8e770b6d97
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>