Commit Graph

419 Commits

Author SHA1 Message Date
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
Jarek Kobus
0420caa3ce TextEditorWidgetPrivate: Disconnect more signals in d'tor
After the TextEditorWidgetPrivate's d'tor has finished,
compiler starts destructing all the member fields of
TextEditorWidgetPrivate before calling base QObject d'tor.
Some d'tors of some members may still emit signals which
are connected to TextEditorWidgetPrivate's slots. In this
case we may start operating on corrupted internals.

Fixes: QTCREATORBUG-26001
Change-Id: I865cad16601b278fe7f7cf95145557310bb83126
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-07-13 14:18:59 +00:00
Christian Kandeler
673d596c84 ClangCodeModel: Provide tooltips via clangd
Note that we temporarily lose the ability to hover over an include and
get the full path of the header file. This is a valuable feature that we
need to restore, preferably by fixing clangd itself.
Fixing the remaining few test failures would likely require more
complicated code as well as additional LSP round-trips, and as of now
I'm not convinced it is worth the effort.

Change-Id: I08c72c4bd1268bbd67baeb57bbfd29d9b11303a5
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-30 08:49:24 +00:00
David Schulz
e13c2b7403 MimeDatabase: add FilePath convenience function
Change-Id: I59c825490b3b5c49f3c177584ea4cc885c4f920b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-23 12:03:28 +00:00
David Schulz
693d54a069 Editor: check highlighter for comment chars before auto fold
The KSyntaxHighlighter Definitions provide single and multiline comment
markers. So check against those when trying to automatically fold the
first license header instead of assuming that '#' and "/*" are comment
markers.

Task-number: QTCREATORBUG-25882
Change-Id: I3a84cfc45445caad3b40feb996cfb781a5fb3190
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-22 11:52:52 +00:00
David Schulz
c3abdd56b7 Editor: merge SnippetOverlay::mangle, ::clear and ::hide
... into SnippetOverlay::accept. We currently have no need for just
applying the mangling without closing the overlay.

Change-Id: I98b2f023253f3676d1aed21438251998be1e509c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-11 12:35:03 +00:00
David Schulz
4445876013 Editor: directly use the Link overload of openEditorAt
Change-Id: I5e863600159cc54a99fec5a20df8de1fbc3d745f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-08 07:37:42 +00:00
Christian Kandeler
ff0301635e CppEditor: Tweak test infrastructure
... so we can re-use the "follow symbol" test cases with clangd.

Call Creator like this (clangd needs to be version 12 or later):
$ QTC_CLANGD=<path to clangd> qtcreator -test
'CppEditor,*Follow*,*Switch*' -test 'ClangCodeModel,*dummy*'

During testing, some invalid code in the test cases was uncovered and
fixed.

Change-Id: I9dc650fdba2a27600e6a550420ee873f6fb31d23
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-02 10:52:50 +00:00
David Schulz
fcd93256c0 Snippets: Allow defining a final snippet tabstop
Change-Id: I8b9704f66c9f0ac33dfb9d8f5e970a85bbcf143e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-28 10:39:35 +00:00
David Schulz
919bbe8408 Core: Use Utils::Link for openEditorAt
Change-Id: I246e06b11b4f32f46d7f3ec93df81bcc676aebbe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-25 17:32:59 +00:00
David Schulz
356bfcc9fd Utils: filepathify Link
Change-Id: Ie62500bde139158e776f9698ee0ea00c2a113f93
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-25 17:32:18 +00:00
David Schulz
44e7047450 Editor: Allow defining custom snippet parser function
Task-number: QTCREATORBUG-22406
Change-Id: I21ae9740d348d4e0869029343d51b70f9df9cdac
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-25 08:16:38 +00:00
David Schulz
665c090039 Core: filepathify IDocument
Change-Id: I364a80d070c5f90433309c281c4906ee101a1a1a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-05-19 09:45:22 +00:00
Eike Ziller
6bb918adab Merge remote-tracking branch 'origin/4.15'
Change-Id: Ic839ab43a723ab22cc83e5b0d823ec6121cb6701
2021-05-10 13:50:58 +02:00
David Schulz
c4605ebc07 TextEditor: Fix painting text mark icons
Only take text marks with icons into account when looking for the three
textmarks with the highest priority to be drawn next to the line number.

Fixes: QTCREATORBUG-25427
Change-Id: I9c0b9cac2e34134e59071a4e2357585b3071c303
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 11:18:16 +00:00
David Schulz
a2dadb3d0b TextEditor: Snippet ranges refactoring
Parsed snippets are now reported in chunks of texts and variables. A
variable has a index that can be used to identify matching variables and
maybe a mangler that can be used to modify the variable when applying
the snippet.

This effictively moves the variable matching logic from the overlay to
the parser of the snippet, which is needed to implement the LSP snippet
parser.

Task-number: QTCREATORBUG-22406
Change-Id: I6999554c6c6d0f1887c98bf732473f01aa1f230c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-03 11:12:34 +00:00