Commit Graph

434 Commits

Author SHA1 Message Date
David Schulz
2b286c755b Utils: allow passing data via info bar combo box
Change-Id: I47daa83a533a76eb4ad0ab3f5cf8c04faf389b98
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-03-21 07:57:10 +00:00
David Schulz
d776445953 Editor: prevent repainting complete editor with for current line
Instead make sure that the widget is updated after the current line
changes.

Task-number: QTCREATORBUG-26812
Change-Id: I9fc754255891ec29d3499da0ee23aa56b1f285aa
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-16 10:37:17 +00:00
David Schulz
b5457750f2 Editor: do not request updates for the complete annotation area
... inside the paint event. We should always make sure to call an
explicit update when we add, remove or change annotations via text
marks.

Task-number: QTCREATORBUG-26812
Change-Id: I5afbdad5e1916e99665b5cb1b1cd2a0bbf7335c3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-16 08:41:54 +00:00
David Schulz
525d26db03 Editor: centralize annotation filtering
Change-Id: I68464b14b44beee772ace93f7bdebc32ae3325ef
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-15 05:22:22 +00:00
David Schulz
32fc9653ed Editor: only update annoations inside event rect
Change-Id: I61c2648734c3d5b3018215a83e7d4226905a6993
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-15 05:22:16 +00:00
David Schulz
febe659690 Editor: filter text marks in paintAnnotation
Calculate the correct width for the annotation and decide inside
TextMark whether it can be painted or not. This will also
make sure that all annotation rectangles are correctly saved in
TextEditorWidgetPrivate::updateLineAnnotation.

Change-Id: I7e6c606e615b1673a34000618e106efb14184b10
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-15 05:22:08 +00:00
Eike Ziller
d295d16ab5 Merge remote-tracking branch 'origin/7.0'
Change-Id: I809383e6c060701a2751197a8bf16add92bfaf0d
2022-02-28 09:21:18 +01:00
David Schulz
4d10a2df36 Editor: only start block selection if alt and shift is pressed
Since it is a selection the shift modifier should be part off the
shortcuts and the old block selection also required both modifiers.
Additionally this prevents creating a block selection by accident when
there are no items in the editor history since alt + arrow left is
mapped to go back in history by default.

Change-Id: I46b0753a737f1e1b3c980d2e959bcf7b4733d790
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-25 10:25:30 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
  utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
  wrappers, that also includes the "public" headers for MimeType et al
  from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
  utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
  back to utils/mimetypes/mimedatabase.h

Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 07:19:58 +00:00
Eike Ziller
8259df00d0 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/mcusupport/mcupackage.cpp
	src/plugins/mcusupport/mcusupportoptions.cpp
	src/plugins/mcusupport/mcusupportoptions.h
	src/plugins/mcusupport/mcusupportoptionspage.cpp
	src/plugins/mcusupport/mcusupportplugin.cpp
	src/plugins/mcusupport/mcusupportsdk.cpp

Change-Id: Ib423e9f23877176f01b188104b0a179ed32c4770
2022-02-22 14:06:41 +01:00
David Schulz
844a5e624a Editor: make sure to cleanup select all future watcher
Change-Id: I39e1bc7926905684601eb72cdd7a4357c708c432
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-18 11:04:51 +00:00
David Schulz
088d692bb2 Editor: fix crash after triggering select all with no search results
Change-Id: I32d5172e8b5df6db93053f358c5a72cb8d38f6ea
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-18 08:09:14 +00:00
Eike Ziller
fcb8d3b2a4 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/qmldesigner/components/itemlibrary/itemlibraryview.cpp

Change-Id: Icda34067bb89d066a3e7eb47f8cca1d62dc3ae0d
2022-02-11 11:20:13 +01:00
David Schulz
a1cc9b4e5c Editor: fix internal cursor position after backspace
Fixes: QTCREATORBUG-27035
Change-Id: Id39d8832c5e3327cd42ce10447da98ca78fe476d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-10 08:00:42 +00:00
David Schulz
08e375d6f7 TextEditor: add highlighter configure based on mimetype
The default implementation configures the generic highlighter based on
the documents file name and content. Add a way to force the highlighter
to use a highlight definition for a specific mime type.

Change-Id: I1c6fca1be9bcb5c4276b5aa2dbb724680fe98ddc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-04 11:41:50 +00:00
Eike Ziller
1368111824 Merge remote-tracking branch 'origin/6.0' into 7.0
Change-Id: Ie2b23daa457c2aed635a784963bc1e95740bd076
2022-02-02 10:17:03 +01:00
David Schulz
fe0352669d Revert "macOS: Fix Delete with Google Japanese IME"
This reverts commit 5a3648c895.

Reason for revert: breaks other shortcuts like shift+del to cut the current line under the cursor

Change-Id: I5313c66df9dfa4283cc3f84ce9e7fd5464d0f73e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-02-01 07:06:26 +00:00
Eike Ziller
be5fb98f1f Merge remote-tracking branch 'origin/6.0' into 7.0
Change-Id: I72684fe4b0857e52a15ee83721f9d7975582a8d2
2022-01-26 09:25:13 +01:00
Eike Ziller
5a3648c895 macOS: Fix Delete with Google Japanese IME
Do not eat all ShortcutOverride events. Let the rest of the class &
widget hierarchy know about them too.

Fixes: QTCREATORBUG-26764
Change-Id: I7e2f42183bc9cb3931aca3669a6703c83e39b4bc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-25 13:46:20 +00:00
Eike Ziller
8db86aba4c Merge remote-tracking branch 'origin/6.0'
Change-Id: I92049adb2b200e9106513eb2275019890bd13b6c
2022-01-19 11:42:32 +01:00
Eike Ziller
3749cfc896 InfoBar: Make adding more buttons possible
Change-Id: Ic0c946cf3f87fe46cd06391f38e0bc71374ad340
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-01-18 09:33:20 +00:00
David Schulz
62c36f516b TextEditor: Fix skipping short lines
Fixes: QTCREATORBUG-26878
Change-Id: I2d801e3c7e91bad928b203bbca32fdc7b1cdca6e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-18 05:45:43 +00:00
Eike Ziller
65e8c864af Merge remote-tracking branch 'origin/6.0'
Change-Id: I405e3f95b0cdcd7b2686f31baae16c03c787f007
2022-01-06 11:55:39 +01:00
David Schulz
e478c915ad Editor: fix maybe select lines
Only select the lines if the cursor has no selection. If we have
multiple cursors with a selection the user most probably want to copy or
remove this selection.

Fixes: QTCREATORBUG-26761
Change-Id: Idbf36a878e3d56ea34542b5de390c547bd8bcd6b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-05 10:26:39 +00:00
David Schulz
02535d6bf8 Editor: fix select all
Prevent scrolling to the end of the document after triggering select
all.

Fixes: QTCREATORBUG-26736
Change-Id: I744dddee87ac16ae2399d37483552fc6b535df46
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-05 09:10:35 +00:00
David Schulz
97a5a24a17 Core: add action to select all find results in an Editor
Change-Id: I71f480abde17cfdb6b64d7d12a33c9887792fc61
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-05 05:59:56 +00:00
Eike Ziller
7d92375b2f Merge remote-tracking branch 'origin/6.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/clangcodemodel/clangdclient.cpp

Change-Id: I75c954d2e573d65089205d2542747bba3276be2a
2022-01-03 14:14:12 +01:00
David Schulz
76921ea170 Editor: skip short lines in block selection
Do not include lines into the block selection that are shorter than the
block selection start column.

Task-number: QTCREATORBUG-26548
Change-Id: I6e4e26e1c498fb02dd0ebc8b78b8907c23f356b8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-03 07:17:30 +00:00
Eike Ziller
d422b408e0 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I32991a77e52831dd2e24cf4a51ec252998c2d743
2021-12-09 12:04:32 +01:00
David Schulz
02d6dfdfec TextEditor: fix delete(Start/End)OfWord without camelcase
Fixes: QTCREATORBUG-26646
Change-Id: I0f9a4ad56ef96632fbf5de490f089bf7ff3b12ee
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-12-06 06:30:22 +00:00
David Schulz
7552c9958f TextEditor: move setIfdefedOutBlocks to TextDocument
The location of the blocks to marked ifdefed out are not tied to a
specific editor instance, but just depend on the document content.

Change-Id: I837730dc00e1d6060dd46bbb2cfccbfa5f72e6ce
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-12-06 05:17:51 +00:00
David Schulz
dbc4cd6f4a TextEditor: always replace cursor
Otherwise some internal data might be outdated. For example inserting
text resets the QTextCursorPrivate::x which is used to calculate
positions when moving the cursor up or down.

Fixes: QTCREATORBUG-26635
Change-Id: I9fee7436a3648f9d3eab7b30f8a09a134c5be356
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-12-02 11:42:46 +00:00
Christian Stenger
38b2bb9fb2 TextEditor: Fix crash in hover handler
Amends 2dbe5c72d8.

Change-Id: If4343f606af1bdf25409ffaef82e44456fee7ee4
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-12-01 15:44:46 +00:00
David Schulz
2dbe5c72d8 TextEditor: fix crash after removing hover handler
If we remove a hover handler from the editor we have to reset the last
cached hover result in the runner to prevent using this removed and
potentially deleted hover handler.

Change-Id: I2bbdbee9d018aac426832552d036926be9ff198e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-11-19 12:30:26 +00:00
David Schulz
e0c115fb9b Editor: Allow creating block selections with alt+shift again
These block selections are a convenience for people used to the block
selection allowing to also unselect parts again (at least as long as
alt+shift is pressed).

Fixes: QTCREATORBUG-26535
Fixes: QTCREATORBUG-26529
Change-Id: I19558dc1d823c268cc1cfda0ea8151bac483701f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-11-08 08:35:38 +00:00
David Schulz
fe9e8417f2 Editor: Fix drop location marker
Change-Id: Id63ff9e8089fd8aaf38fb61ff6d79384a60135d7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-11-05 10:34:43 +00:00
David Schulz
e96c664fce Editor: Fix drop position of drag and drop operation
Change-Id: I6649b0506e06bccb681c66afc91ad85f763206c4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-11-05 10:34:38 +00:00
David Schulz
416cd69a5e Editor: unselect text on mouse release event
Update the main cursor after calling QPlainTextEdit::mouseReleaseEvent.
Calling that function might change the selection without changing the
position, so it wont emit cursor position changed, and the multi cursor
does not get updated properly.

Task-number: QTCREATORBUG-26493
Change-Id: Ie310ee9a4c66897766af87065ee42fcd01302854
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-11-04 09:10:05 +00:00
David Schulz
d5467917d0 Editor: Collect keyboard selections to the clipboard
Fixes: QTCREATORBUG-26492
Change-Id: I36c3ae73d8d5b2ea92cee3fd7c568b958c3235ae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-10-29 10:57:53 +00:00
David Schulz
d6c3a7297d Editor: fix clipboard collecting via mouse selections
Fixes: QTCREATORBUG-26471
Change-Id: I08264204c5ea5753b326417e5ba3a451cc6ef8f6
Reviewed-by: hjk <hjk@qt.io>
2021-10-27 07:56:45 +00:00
Orgad Shaneh
3871e40f43 Fix qHash-related size compatibility warnings by MSVC
Change-Id: I3b7981ce78b67db4b996f99682284a0b911d8cd7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-10-20 15:03:51 +00:00
David Schulz
181a2927fe Editor: fix unindent
Fixes: QTCREATORBUG-26412
Change-Id: I9743d3ff10b89318270eee43899da6c2baccad20
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-10-20 12:02:17 +00:00
Petar Perisin
31b42db4b6 Follow symbols with Ctrl+LMB and Ctrl+Alt+LMB
Change-Id: I85620ad43cdd385d2a4666c874b9c48263d3dffd
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-29 06:28:06 +00:00
David Schulz
c00330f905 Editor: multi cursor support
Adding a way to create multiple cursors that can insert/remove text at
arbitrary positions in the document. Adding cursors is done by pressing
alt + up/down or by clicking into the editor while holding the alt key.

Fixes: QTCREATORBUG-16013
Change-Id: I495d27d95a3d277220946616ef30efc241da0120
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-27 10:56:54 +00:00
David Schulz
421e06393f TextEditor: update matching parenthesis in the editor
... after updating the parenthesis in the layout

Task-number: QTCREATORBUG-26183
Change-Id: I346046fbc3932b94227c1ac5bee6b0d7c44651e1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-09-24 11:50:54 +00:00
David Schulz
17b05bc3e8 Clangd: Create correct code assist processor in provider
... for the context of the code assist instead of using a callback from
the text editor.

Change-Id: I636b1b267a944895d4ff732e3c0a8811332ec14f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-09-17 12:00:18 +00:00
Christian Kandeler
2b09c81682 TextEditor: Handle context help requests like tooltip requests
That is, don't just ask one random hover handler, but try all of them
and use the best one.

Change-Id: I38d0a90e96090c56240314a90f0f428c88fd222c
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-15 09:11:29 +00:00
David Schulz
d739ba8a7d TextEditor: use cursor to comment selection
preparation for multi cursor support

Change-Id: I57d318ee325e3667a6377a972a0eda66e43d0349
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2021-09-07 06:38:08 +00:00
Christian Kandeler
e0e8fda580 ClangCodeModel: Use clangd for completion and function hint
Change-Id: I80160f3a40da18ac178682afe6caba5e5af6e3eb
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-23 09:06:31 +00:00
hjk
5731965045 Utils: Use FilePath in DropSupport
Change-Id: Id048d0dab4c58be367a081bb8041214abd6dbf98
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-02 06:59:53 +00:00