Commit Graph

59 Commits

Author SHA1 Message Date
Marcus Tillmanns
9f1a2c4f8f Terminal: Rework commands
This rework fixes the way commands are registered in Qt Creator.

Change-Id: I401f3ac7d9194dad8fceb507360ddc3633106eb4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-31 13:17:49 +00:00
Marcus Tillmanns
3416ccd7ec Terminal: Fix selection
When moving the mouse left or right out of the viewport
the selection would grow into the previous/next line
without the bounding.

Change-Id: Ica38eac3b306338ef24aa4abace66f110edb2aef
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-05-16 11:50:18 +00:00
Alessandro Portale
f2213db913 Terminal: Fix warning
warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]

Change-Id: Ib66cbde9ff48f31d1a5ca97c8bafb0efd419dc2e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-12 06:34:49 +00:00
Marcus Tillmanns
734f559b76 Terminal: Fix cursor/viewport updates
Under some font sizes the cursor size and cell size were not correctly
aligned on the pixel grid, leaving behind artifacts of prior draws.

Change-Id: I25e6efdc44102f24672912e1e56c31be0c686b89
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-05-09 11:20:42 +00:00
Marcus Tillmanns
f4abb1ec4a Terminal: Remove unnecessary destructor
Calling Aggregate::remove is not necessary and led to a warning message.

Change-Id: I51cdd7bfa9bdda7a3ebedf6a86e48fe54fd8f3ef
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-05 09:21:51 +00:00
Jarek Kobus
470c95c94b Utils: Rename QtcProcess -> Process
Task-number: QTCREATORBUG-29102
Change-Id: Ibc264f9db6a32206e4097766ee3f7d0b35225a5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-04 05:52:16 +00:00
Marcus Tillmanns
aeb2b458d0 Terminal: Allow dropping files
Change-Id: I978ea72d6de7df6c31d1d2d2368e7aadf835279d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-04-26 07:08:08 +00:00
Marcus Tillmanns
d05faf64f4 Terminal: Correctly parse url links with empty path
Previously urls such as http://google.com were appended to the current
dir, as FilePath::isAbsolute would return false since there is no path.

Change-Id: I17546aed322a74f6b8cbcc166d37608fd809fd1e
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-04-06 13:06:11 +00:00
Marcus Tillmanns
388e516200 Terminal: Improve link copy
* Show link if control key is pressed (without mouse move)
* Copy link on Control+Shift+Click
* Add Copy Link Action to Right click menu

Change-Id: Ide4ff4e77c03e015117c67f09c9d60dedd14dfcb
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-04-06 09:25:36 +00:00
Marcus Tillmanns
b999e5700e Terminal: Fix docker cmd for terminals
* Fix env for terminals

Change-Id: Ie16a74aeca3ad34a76af1dee0c5a01e607aabebb
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-04 05:59:35 +00:00
Marcus Tillmanns
94c4800ad8 Terminal: Fix crash when reusing TerminalWidget
Change-Id: I9d30df1abbecabd3909078e0a609fe5ba96769ae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-03 07:53:23 +00:00
Marcus Tillmanns
5db27d21da Terminal: Add setting to change arguments of default shell
On non windows systems, initialize it with "-l" to start a login shell.

Change-Id: I972f845c3933c6a54752d4c71108a658311a0256
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-28 07:13:00 +00:00
Marcus Tillmanns
4ab5eb5339 Terminal: Fix warning messages
Change-Id: I1ab473c79219cf6e2adefaa1349b4675a2455b2f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-27 09:30:09 +00:00
Marcus Tillmanns
2eb4884742 Terminal: Make audible bell configurable
Change-Id: I6cc02f2f1b873f39352151265fb7ba1fe0f170fc
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-27 09:29:54 +00:00
Marcus Tillmanns
af5f702f54 Terminal: Make ESC key behavior configurable
Change-Id: I806870c5dd7edbcd3ac2642849cca82f1939ce01
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-27 09:29:47 +00:00
Marcus Tillmanns
ae94d3b7ea Terminal: Handle bell
Change-Id: I61681166fc8e489ffd0807cf3bcb4a2abc9cf6e1
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-24 16:12:05 +00:00
Marcus Tillmanns
9417f8b99e Terminal: Add search
* Adds new search widget to terminal
* Adds new theme color "TerminalFindMatch"
* Fixes ESC key handling in terminal

Fixes: QTCREATORBUG-28946
Change-Id: I7b6057d13902a94a6bcd41dde6cc8ba8418cd585
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-24 16:12:01 +00:00
Marcus Tillmanns
17a482bebe Terminal: Support paste via Middle mouse button
Fixes: QTCREATORBUG-28943
Change-Id: If48c021e509e10fd13e6e5356d0a364e91aae8da
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-24 13:16:23 +00:00
Marcus Tillmanns
7fe4fde886 Terminal: Open directory links in navigation
Fixes: QTCREATORBUG-28938
Change-Id: If49def66501ff29f72d8a92e3971da6be5d93367
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-23 14:07:00 +00:00
Marcus Tillmanns
1c099b2bd2 Terminal: Use current dir for links
Fixes: QTCREATORBUG-28942
Change-Id: I424676d3ef3395eead9c4c0c0e826e1c44500b40
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-23 14:06:52 +00:00
Marcus Tillmanns
e045c643c3 Terminal: Support Alt+Left / Alt+Right cursor move
Fixes: QTCREATORBUG-28941
Change-Id: I7c8e012733f6dcb2851e8e1b840d53317e413cd8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-23 14:04:59 +00:00
Marcus Tillmanns
af809b3a52 Terminal: Add context menu & Settings button
Fixes: QTCREATORBUG-28937
Change-Id: I9dab5da0adccb8cff4d4e824ead0eba3e27eef5c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-23 12:32:07 +00:00
Marcus Tillmanns
a485f18a94 Terminal: Make shortcuts configurable
Fixes: QTCREATORBUG-28940
Change-Id: I1afe114c357243a8fa4f101b5eac80a766dc87b9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-23 12:31:53 +00:00
Marcus Tillmanns
5341570572 Terminal: Move color mapping to widget
This allows us to easily update the view when the colors are changed
in the settings.

Change-Id: I0b4f150b4fc9cec9aee2796d63f2395e05ce70df
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-23 11:32:51 +00:00
Marcus Tillmanns
0870f2583b Terminal: Enable TerminalProcessInterface
Adds a new helper app "process_stub" that replaces the previous.
"process_stub_unix/win". The purpose was and is to allow processes
to be "injected" into other hosts apps like terminals while still
being able to control and debug them.

A new base class called "TerminalInterface" is used for both the new
Terminal plugin and the legacy TerminalProcess implementation.

Fixes: QTCREATORBUG-16364
Change-Id: If21273fe53ad545d1a768c17c83db4bf2fd85395
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-03-20 10:03:23 +00:00
Marcus Tillmanns
2d2eef1c2c Terminal: Fix "Enter does not work after copy"
Change-Id: Ic541ba15f52084bcd9b955af718efc3defc64539
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-20 09:45:23 +00:00
Marcus Tillmanns
5972452484 Terminal: Support clipboard selection
Change-Id: Ief59f9e21782e0dd0292f3625e35c1742cf9b3bc
Reviewed-by: hjk <hjk@qt.io>
2023-03-18 13:03:17 +00:00
Marcus Tillmanns
bd52e53dbf Terminal: Add shell integration
Change-Id: Ic1e226b56f0103e5a6e7764073ab7ab241b67baa
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-16 06:08:09 +00:00
Jarek Kobus
a43c20969c QtcProcess: Remove TerminalMode::Pty enum value
Make Pty::Data optional. When set, the PtyProcessImpl
implementation is implied.

Change-Id: I7990e9d9016223e6597d876a5d0c4ed177365874
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-15 13:52:45 +00:00
Marcus Tillmanns
887f6afd25 Terminal: Auto-scroll when selecting outside
Change-Id: I5dea3256524634d9c3e6c0f8132c6bdba4494978
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-12 09:22:38 +00:00
Cristian Adam
215bd2ef2b Terminal: fix copy to clipboard of bottom up selection
The multi line selection from bottom right corner to top left was broken
for copy to clipboard.

Change-Id: Ica40ec2ce5bb7b9d4b0187ebb454cd16e039e339
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-11 12:26:47 +00:00
Marcus Tillmanns
ddad64e176 Terminal: Fix multi-line copy&paste
Previously all lines would be copied into one without lines breaks.

Change-Id: Id87dbde84a19ccbc5f53438a305173d1b070eaba
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-11 11:19:24 +00:00
Marcus Tillmanns
7ceb185539 Terminal: Fix line selection mode
Change-Id: I03d4bf7343a49b19edfcb20d1eb57bfe18703ddf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-11 11:18:31 +00:00
Marcus Tillmanns
e54b0e93c2 Terminal: Fix selections
Selections were invisible if a cell with a background color
was selected.

Changes to the terminal did not reliably reset the selection.

Change-Id: I923223f43e5ee1b6576966f9dd791aa109ac1d5f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-09 19:57:17 +00:00
Marcus Tillmanns
b95c0d247d Terminal: Fix "altscreen" handling
When "altscreen" is enabled ( e.g. when starting nano ), the terminal
switches into an alternate mode without scrollback buffer.

This was not correctly handled where the scrollback buffer would stay
active.

Change-Id: I443d26383d9cd908befcd24a837ecf84c0c1e849
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-09 19:57:08 +00:00
Marcus Tillmanns
665ae04605 Terminal: Open Link with line/column info
Change-Id: I3e70a7c33a935b7bd3e12fb903148bcd60ff55aa
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-09 19:56:48 +00:00
Christian Stenger
0f1f5435ea Terminal: Fix build before Qt6.4
Change-Id: Idc1138289516eb2cdeffc310cec4b9ba019d1b16
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-03-07 05:54:58 +00:00
Marcus Tillmanns
f95f815e98 Terminal: Add support for Cursor shape and blink
Change-Id: I7f71578a714d375bcd4ef8ae431f4127cbc57a55
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-06 22:55:50 +00:00
Marcus Tillmanns
098c76832a Terminal: Rewrite rendering
The rendering has been rewritten to use cached GlyphRuns instead
of text layouts. The VTerm specific code was moved into
TerminalSurface.

Change-Id: I10caa3db4ee932414987c9ddae2dcb777dc1f6e7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-06 15:41:29 +00:00
Marcus Tillmanns
74f15c99ce Terminal: Fix Ctrl+[A-Z] and '|'
Change-Id: Id245a015d6092236c20634c47af682bcf073d982
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-03 20:00:02 +00:00
Marcus Tillmanns
7fc674b566 Terminal: Fix "nano" titlebar
QTextLayout ignores trailing spaces, and does not draw their
background color. Converting them to Nbsp fixes this.

Change-Id: I19a363bcb4792c613eb9c59f7caaa40fa631b937
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-03 19:59:30 +00:00
Marcus Tillmanns
dc4ec494b3 Terminal: Fix mouse selection
Previously m_selection was not correctly ordered such that start < end.
This patch fixes that and also adds optional debug visualizations to aid
in debugging / validating the selection.

Change-Id: I9b0d2fcd917f39eeb5082bc374796fed91521c7c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-03 19:55:05 +00:00
Marcus Tillmanns
240686b7ea Terminal: Start with disabled copy action
The copy action should only be enabled once a selection exists.
In the beginning no selection can exist, therefore the copy action
is disabled.

Previously this lead to a bug where only the second "Enter" keypress
was passed on to the terminal.

Change-Id: Iac01c273f70a50a4fc131bd6a2bbb1507705b853
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-03 08:24:31 +00:00
Marcus Tillmanns
9b7b0d4f02 Terminal: Switch to std::chrono
QDateTime's interface various between supported Qt Versions,
so we use std::chrono instead

Change-Id: I5af5ae9950e61c2ed38ff15dc0580f0dc2aa1f57
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-03-03 07:35:05 +00:00
Cristian Adam
d387802a3e Terminal: use shell name as terminal tab name
This way cmd, bash, powershell are more descriptive than "Terminal"

Change-Id: I19310f423cd4188ecc48580a30ed414833a15aee
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-02 16:54:59 +00:00
Cristian Adam
0a0827da41 Terminal: Improve keyboard shortcuts and mouse copy/paste
Change-Id: I7e032a48cc55143dd8fb038d74eb71c4ad8badac
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-03-02 16:54:53 +00:00
Marcus Tillmanns
d8dc1c7f0f Terminal: Improve performance while selecting
Change-Id: I4f0a7a937f6e600430d8c89e51d1ea2d1ab8687f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-02 14:20:01 +00:00
Marcus Tillmanns
76b55fd6e6 Terminal: Implement selection via double click
Change-Id: I7665df5f37836331f202f168828bb1b1636bf5de
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-03-02 14:19:56 +00:00
Marcus Tillmanns
46ccaa642f Terminal: Improve performance for cat /dev/random
Change-Id: Ibc7e09dd9388fd6f06f0bed3ade4e83d05f03c28
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-02 14:19:47 +00:00
Marcus Tillmanns
86da87d306 ProjectExplorer: Remove IDevice::terminalCommand
Since Terminals can now be started for device file paths, there
is no need anymore for IDevice::terminalCommand.

Change-Id: I01c831ea7ee29d53efa6880631e8c6d54a4316aa
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-03-02 14:13:19 +00:00