Commit Graph

346 Commits

Author SHA1 Message Date
David Schulz
6e846b6606 TextEditor: skip painting annotations for disabled text marks
Change-Id: Id05bfe5bd120b2bbb2e2b70fb29a99b8c430e459
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-27 07:38:30 +00:00
David Schulz
0ca9ea353c Editor: Do not use disabled code color for right margin highlight
Fixes: QTCREATORBUG-17174
Change-Id: I68729d5a44b23fe46b810054a1dc472ffd63e272
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-21 04:32:27 +00:00
David Schulz
f220cb0e23 Revert "Editor: Make line spacing adjustable"
This does not work with text wrapping since there are multiple
QTextLines inside a block but we can not adjust the line hight inside a
block. This needs to be addressed inside Qt.

This reverts commit dc64f3207b.

Change-Id: If6c28056da9891eeeb75f5939a42f08360013a80
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-20 04:35:42 +00:00
David Schulz
05ad4e3daa TextEditor: fix selection highlight
Also compare the anchor when looking for the selection. Otherwise we
might get a selection highlight that expands on adjacent extra
selections like code model warnings.

Change-Id: Ib8460c1089ed69d14b7a408ca70e7ac1f8642f6e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-19 04:16:13 +00:00
David Schulz
3c281aa483 Editor: Select moved text after drag and drop
Fixes: QTCREATORBUG-24245
Change-Id: I9da52424128825f729d5d20e2c7fd095120477c6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-06 07:54:27 +00:00
David Schulz
dc64f3207b Editor: Make line spacing adjustable
Fixes: QTCREATORBUG-13727
Change-Id: I3dbc3277795b339bced81dc6c5a048c828183cb6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-01 12:11:09 +00:00
David Schulz
f6b3f41d19 Editor: Skip auto inserted characters with tab
Fixes: QTCREATORBUG-12641
Change-Id: I9800b939118d1e46d202454a66729cd81d2c08b3
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-29 07:17:05 +00:00
Eike Ziller
bbe95b5733 Qt6: Various include, QPrinter, and QFlags adaptations
Task-number: QTCREATORBUG-24098
Change-Id: I7aca7d25a063c84d6eec14c2c5789357ce56a7b3
Reviewed-by: hjk <hjk@qt.io>
2020-09-28 15:51:21 +00:00
Eike Ziller
cc502e3667 Remove bool return value from IEditor::restoreState()
It's never used, and actually there wouldn't be any sensible thing to do
with it.

Change-Id: Id8a8df18c7db4b98e5abbc034240bb90dc1dcaa9
Reviewed-by: hjk <hjk@qt.io>
2020-09-24 13:02:56 +00:00
Eike Ziller
423ea729f8 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/mcusupport/mcusupportoptions.cpp

Change-Id: I3fd0d0a6a3ff30bb990da3dc0f78e69f9e1247ef
2020-09-23 10:11:44 +02:00
David Schulz
da2e8bbf7b Editor: fix hanging when using invalid printer page rect
Some printer seem to return an empty page rect for some configuration
which results in an invalide page count and a freezing ui. Do not print
anything and return in that case.

Fixes: QTCREATORBUG-24110
Change-Id: I42349bc97734e3f6a67502482d2b02959e865665
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-21 10:18:29 +00:00
David Schulz
d99e00c49f TextEditor: allow highlightings in selections
If the selection foregound color is undefined do not overwrite the
already applied highlighting.

Fixes: QTCREATORBUG-24656
Change-Id: Ia125e8e6b9efba73d5a13facc2446a793d59f5c3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-09-21 07:16:43 +00:00
Eike Ziller
20f51bc642 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	src/plugins/languageclient/languageclientcompletionassist.cpp

Change-Id: If12e1c532e5623ef063681309a918e7b51117b1c
2020-09-14 10:12:14 +02:00
David Schulz
3b23cab385 TextEditor: Use selection format from the setting
Overwrites the format generated by QPlainTextEdit::getPaintContext()

Amends 9182d4eda7.

Fixes: QTCREATORBUG-24479
Change-Id: Ia226a74442dbbdbae42e8da5dee9e4d7399b677c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-09-11 11:48:29 +00:00
Eike Ziller
7aa0b1ea6b TextEditor: Fix build with Qt6
Adapt to QStringRef and QAbstractItemView::viewOptions() removal

Task-number: QTCREATORBUG-24098
Change-Id: Ia2d446312f68bd60143796284d31f5bba56aa0ed
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-09-08 07:47:30 +00:00
David Schulz
dba4bff703 TextEditor: use Utils::FilePath as file member in AssistInterface
Change-Id: I3bf9b013b9350411f918efdb9d1a36a2c22bf972
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-04 10:14:21 +00:00
Eike Ziller
5183994a30 Merge remote-tracking branch 'origin/4.13' into master
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: Ibb60b8a7ac531b239bb9c490da843d5cc1a6300a
2020-08-14 13:31:05 +02:00
David Schulz
462a0f5b5d Editor: add log for printing
Task-number: QTCREATORBUG-24110
Change-Id: Ic4fef2e268cf3adf852a3ce7b229cb98356bbc5e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-08-14 10:05:50 +00:00
hjk
d3d683ec63 Core/TextEditor: Replace QTimeline::setCurveShape
... by setEasingCurve().

Deprecation for 5.15.1/removal in 6 is looming.

Task-number: QTCREATORBUG-24098
Change-Id: Ic116cf78b8468f03f6b01e0b7af56584289589cc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-16 10:33:21 +00:00
David Schulz
9182d4eda7 Editor: Do not use the editor palette to store editor scheme colors
Otherwise all editor ancestors like scrollbars might get an incorrect
palette.

Fixes: QTCREATORBUG-24270
Change-Id: I133cd1dbe284282122972130666c280ea412ea1a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-08 04:17:04 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +00:00
Friedemann Kleint
2bc4d82d31 Fix crash opening UI files
Add a null check, amending
aaa1376576.

Fixes: QTCREATORBUG-24241
Change-Id: I63e76b9d2dd10034b637f8f3cac5001b15b35d30
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-06-25 05:26:14 +00:00
Christian Stenger
d47f8eaff2 TextEditor: Utils: Do not use invalid regular expressions
Having a search inside a document and switching the find options
to use regular expressions may end up in lots of warnings
regarding using an invalid expression for a match call.
Check beforehand to avoid this.

Change-Id: Ia929090ae3910ff3fa87b57a5718293d2b6ccd04
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-06-22 09:19:59 +00:00
Eike Ziller
7c5ed6f7d9 Move InfoBar to Utils
The only reason it was required to be in Core plugin, was its use of Id,
which now is available in Utils.

Change-Id: I66ce863c24924e6448d339b3422538a7fe167336
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2020-06-18 06:39:54 +00:00
David Schulz
aaa1376576 Editor: Allow setting the optional action mask per editor
Instead of just enable actions that were disabled from the beginning you
can no disable optional actions.

Change-Id: I986b8a72523a8aeec9f4ccf76cd4921018ffc003
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-06-17 09:47:44 +00:00
David Schulz
5f91985931 Editor: enable optional actions per editor
Use an additional action mask to enable actions like find usage and
rename symbol per editor instance.

Change-Id: Iabee1820d0f3c156ad30ba760bfce9f6181045e6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 07:51:35 +00:00
Christian Stenger
29e60f0741 TextEditor: Replace QRegExp by QRegularExpression
Task-number: QTCREATORBUG-24098
Change-Id: Id407154bd7d05bf5bbf07a804959e87452225c70
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-06-16 07:40:18 +00:00
David Schulz
3559af69db TextEditor: move rename symbol action to text editor
Task-number: QTCREATORBUG-21578
Change-Id: I9a873dcd38bacb2287c45973b6be0091c3eb9480
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-12 04:28:19 +00:00
The Qt Project
86a3b94902 Merge "Merge remote-tracking branch 'origin/4.12'" 2020-04-24 11:59:18 +00:00
Eike Ziller
d79febdde9 Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakekitinformation.cpp

Change-Id: I90ef0063ed24e23bcb3d73fff086f50324faa1e2
2020-04-24 13:58:05 +02:00
Christian Stenger
0655ddbd65 TextEditor: Display cursor position
Change-Id: Ie5fd13ee80dcf14b6e6c8c0e220f5e00e654dde2
Reviewed-by: Federico Guerinoni <guerinoni.federico@gmail.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-04-24 10:38:40 +00:00
Friedemann Kleint
6cfe092301 Fix printing source code
After qtbase/4a240bb67e72b34c80af448e0a74846609fa6975,
the scaling of the margins changed.

Fixes: QTBUG-81121
Change-Id: I6987fe8e25da1771dd2bcd36fff8558fefd3dee0
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2020-04-24 08:23:05 +00:00
David Schulz
5b15e7e415 Core: move CodecSelector dialog to Core
Task-number: QTCREATORBUG-23835
Change-Id: I824ae9650c244fffc064ade718fc788fc2908ada
Reviewed-by: hjk <hjk@qt.io>
2020-04-15 16:41:57 +00:00
Viacheslav Tertychnyi
4880694df4 TextEditor: Improve column selection
Add the possibility to more efficient column selection for large
documents using keyboard shortcuts Alt+Shift+PageUp/PageDown/Home/End.

Change-Id: Iaa2d9aeee587f1317dd82d7fef0b01fd5f5f7a55
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-04-02 13:09:43 +00:00
Eike Ziller
bac32dc740 Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/coreplugin/dialogs/shortcutsettings.cpp

Change-Id: I1f21845350bb69268ca51bc77167a8244adce22a
2020-03-26 15:26:27 +01:00
David Schulz
b06ad16160 TextEditor: Make accidentally activating a link more difficult again
Only follow links under cursor if control was already activated when
pressing the mouse button. This amends
11eea3aae0 which just checks if control is
pressed after releasing the mouse button.

Change-Id: I90d23dd3e5ff63aac7812fad889ad9fb7c052b56
Fixes: QTCREATORBUG-23745
Reviewed-by: Alexis Murzeau <amubtdx@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-25 09:13:59 +00:00
Eike Ziller
d0589d7f6e Highlighter: Fix typo
Change-Id: I491f7c58733a333a5cdcf2ebae67f9d4bff1eeef
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-24 12:49:43 +00:00
Eike Ziller
ba4a604d68 Editors: Fix top/bottom split with cursor visible at end of document
It did not center on the text cursor.

- Fix lastVisibleBlockNumber() to return the last block if the editor is
scrolled to the bottom (and there potentially is no block located at the
very bottom edge of the editor widget).
- Fix comparison of block numbers (0-based) with line numbers (1-based)

Change-Id: I21405443bea3533e393a7cf320ded6d47f647949
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-16 14:48:36 +00:00
Friedemann Kleint
b8ad0fdae9 Fix QPainterPath-related compilation errors in Qt 5.15
Some include of QPainterPath was removed in Qt, causing errors like:

easingpane\easinggraph.cpp(258): error C2079: 'path' uses undefined class 'QPainterPath'
easingpane\easinggraph.cpp(275): error C2027: use of undefined type 'QPainterPath'
easingpane\easinggraph.cpp(305): error C2664: 'void QPainter::drawPath(const QPainterPath &)': cannot convert argument 1 from 'int'
to 'const QPainterPath &'
easingpane\easinggraph.cpp(305): note: Reason: cannot convert from 'int' to 'const QPainterPath'
easingpane\easinggraph.cpp(305): note: use of undefined type 'QPainterPath'
...

Add the missing include statements.

Change-Id: I4f3383cbcec891a52480a683c9c76ed5deee2b2a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-03-12 09:47:02 +00:00
Eike Ziller
d2759075de TextEditor: Do not overwrite existing indenters
In 6959618d7b a default indenter was set
on all text editor factories.
Unfortunately some editors, like the C++ editor, set their indenter in
the text document constructor, which would then be overridden by this
default indenter.
For now remove the default indenter again until this is better thought
through.

Partially reverts 6959618d7b.

Change-Id: I8f32e92438883edb6be853fa838b75297347a937
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-05 07:14:40 +00:00
Eike Ziller
6959618d7b TextEditor: Use simple text indentation as default
Simple indentation based on the previous line was already available in
the NormalIndenter class. Merge that up the hierarchy chain into
TextIndenter which is the base for other text-based indenters, and make
that the default indenter for text editor factories.

Text editor factories that don't have a special indenter get at least
basic indentation support for free that way.

Change-Id: Ib977a990f10a99bead82bc8a8348c02a106665f1
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-04 06:55:37 +00:00
Eike Ziller
956fd44c3e TextEditor: Improve splitting top/bottom
If the text cursor is visible, but in the bottom area of the editor, it
would be no longer visible after splitting. That makes the probable
"area of interest" vanish from sight.

Check that condition (visible before, but would not be visible
afterwards), and if that is the case center the text cursor in both
resulting editors.

Change-Id: I8c8dccd2d9db439c82d0aca34b8ef99fa97aa48e
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-02-27 14:25:58 +00:00
Eike Ziller
56d2dab5fe Merge remote-tracking branch 'origin/4.11' into 4.12
Change-Id: I7e526857a4d9e63838f76d5e3fbb0db7287d5617
2020-02-27 09:35:11 +01:00
Eike Ziller
c912ee6862 TextEditor: Fix scrolling state after splitting
And when restoring editors in other ways (like from a session).

When splitting, the new editor was always scrolling to make the text
cursor visible, even if it wasn't visible in the original.

1. open editor with long contents
2. scroll away from the text cursor, so the line isn't visible
3. split and wonder

or 3. close and re-open Qt Creator, and restore the session

Our code already does set the state of the new editor to the old one,
but that state was destroyed by QPlainTextEdit::showEvent, which scrolls
on first show if text was added to the document.
So, wrap the showEvent with save/restoreState on first show.

Change-Id: I95e0b4e963ebb33d13ce020affaf7fc7f94c9257
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-02-26 14:12:01 +00:00
David Schulz
af52b65d6a Editor: Fix self recursive update
The update rect should be identical to the calculated line rect when
repainting the current line highlight. And the offset must not be
calculated into the line rect since we just want to repaint the complete
viewport width.

Fixes: QTCREATORBUG-23647
Change-Id: I0656f0fee4823c8ff55c70b2a4cd69f0183e141d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-26 08:09:54 +00:00
Eike Ziller
fa59e02f89 Merge remote-tracking branch 'origin/4.11' into 4.12
Change-Id: I8cc80483cdb10309bf73aba5cfab52c1d90e1bbc
2020-02-26 08:14:47 +01:00
David Schulz
63e9c4c31a Editor: Prevent setting negative position in block selection
Fixes: QTCREATORBUG-23622
Change-Id: I0f041a772869695e7d460effd4b0d58f94ce55ec
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-25 09:49:06 +00:00
David Schulz
aee78bd58d Editor: do not split on nbsp in rewrap paragraph
Change-Id: I443400056f647a58a98d9bb6a221b10852470ba2
Fixes: QTCREATORBUG-23643
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-02-20 12:45:28 +00:00
David Schulz
909cb3859b Editor: update proposal widget after editor contents changed
Also when text is removed via shortcuts.

Fixes: QTCREATORBUG-15038
Change-Id: I1c78b9306594fbf13378a55b27be18769de141a6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-18 12:03:07 +00:00
Eike Ziller
d43f1662d0 Make TextEditor setup more flexible
So far it was only possible to combine TextEditorFactory, BaseTextEditor
and TextEditorWidget directly.
That TextEditorWidget is also directly a QPlainTextEdit made it
impossible to "decorate" the text editor widget with something else
without a lot of effort.

Make it possible to create a text editor factory that returns an
arbitrary widget, as long as it can be "cast" to a TextEditorWidget with
either qobject_cast or Aggregation::query. That way the TextEditorWidget
instance can be attached to the editor widget via Aggregation.

Adapt other code that accesses TextEditorWidget from editors
accordingly. Introduce a common method how to do that.

Change-Id: I72b8721f3a8a8d8281c39af75253e9c80cbe1250
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-02-12 10:28:31 +00:00