Commit graph

270 commits

Author SHA1 Message Date
Robert Paciorek
ca97b654ee rework _handle_selection()
* do not use timer for selection, due to issue with Engine.time_scale == 0
  * deciding on redraw based on target cell change
  * deciding on send to system based on mouse button up event
  * remove _on_selection_held() timer callback function and SelectionMode enum
* on non-Linux system use clipbord when copy_on_selection is active
2024-07-06 22:51:45 +00:00
Leroy Hopson
64aa0ff49a perf(term): merge custom theme with default theme
Merges a custom theme containing 'Terminal' theme properties with the
default theme rather than setting them on the default theme directly.

This improves performance for initial loading of the plugin.
2024-06-09 21:54:39 +12:00
Leroy Hopson
8b33818751
fix(plugin): fix some errors and warnings 2024-05-19 12:14:04 +12:00
Leroy Hopson
608f27ba0c
fix(icon): use custom icons for Terminal and PTY 2024-05-19 11:42:27 +12:00
Leroy Hopson
98394bfbf5 chore: remove unused code 2024-05-10 22:50:39 +12:00
Leroy Hopson
d49f522802 feat(term): replace 'Copy All' menu item with 'Select All' 2024-05-10 22:16:45 +12:00
Leroy Hopson
892ed45159 fix(term): select() fixes
- Ensure selection is drawn.
- Allow deselection by mouse click.
- Respect copy_on_selection attribute.
2024-05-10 22:16:45 +12:00
Leroy Hopson
b29d809bc0 chore(term): remove unused code
Removes unused code from `terminal.gd`.
The status of `update_mode` is still unclear, so has been left for now.
2024-05-10 22:10:13 +12:00
Leroy Hopson
77b1481f8e feat(term): re-enable keyboard shortcuts
Closes #65.
2024-05-05 16:41:04 +12:00
Leroy Hopson
4c4e61cf99 feat(term): make cursor hollow when un-focused
Closes #29.
2024-04-28 23:26:02 +12:00
Leroy Hopson
c4c0f9c90a
chore(auto): automatic editor updates 2024-04-28 18:27:19 +12:00
Leroy Hopson
d6a4adf6aa
feat(terminal): and stylebox support
Adds support for 'normal' and 'focus' Style Boxes to Terminal node.
Changes default background color to transparent, with background to be
set by StyleBox.

If background color is not transparent, will draw a background color
rect to cover the entire control over the top of any stylebox. This is
consistent with the behavior of the TextEdit node with regards to theme
colors and styleboxes.
2024-04-28 18:09:21 +12:00
Leroy Hopson
a5951978f7
fix(pty): emit size_changed if forcing size update
Ensures that connected PTY is resized correctly on scene start.
2024-04-28 17:29:41 +12:00
Leroy Hopson
5c151c3244
feat(editor): make editor terminal functional 2024-04-28 17:29:40 +12:00
Leroy Hopson
e816396d60
feat(pty): add terminal_path property to pty
Property can be set to the NodePath of a Terminal node. Doing so will
conveniently set up the neccessary signals between Terminal and PTY for
them to function together.
2024-04-28 17:29:40 +12:00
Leroy Hopson
fa49834347
feat(theme): update themes 2024-04-28 17:29:40 +12:00
Leroy Hopson
dd118d72f3 feat(term): add select method
Adds select() method to Terminal. Method behaves the same way as
TextEdit's select method.
2024-04-28 17:22:26 +12:00
Leroy Hopson
43303a51bf fix(term): copy_selection() when nothing selected
Fixes the copy_selection() method so that it returns and empty string
when called and nothing is selected. Previously printed an error.
2024-04-28 17:22:26 +12:00
Leroy Hopson
898d49e392
fix(theme): fix regular font resource 2024-04-06 23:56:01 +13:00
Leroy Hopson
4bd25bb92c feat(theme)!: set a default theme
Adds 'Terminal' type to the default theme. Sets values to those similar
to CodeEdit and TextEdit. Colors default to Xterm defaults.
2024-04-01 21:26:24 +13:00
Leroy Hopson
e732712b55 feat(theme)!: replace hack with jetbrains mono
Replaces the Hack font with JetBrains Mono which is the new default code
editor font in Godot 4.
2024-04-01 21:18:00 +13:00
Leroy Hopson
6384f41837
chore: update license info 2024-04-01 19:42:22 +13:00
Leroy Hopson
6c8be30e7f
fix(pty): initialize exit_code to 0
Uninitialized exit_code variable was causing tests to fail on x86_32
arch due to returning an arbitrary int where 0 was expected.
2024-04-01 10:12:16 +13:00
Leroy Hopson
ff95b60a56 feat(web): re-enable web exports 2024-03-30 22:52:39 +13:00
Leroy Hopson
fcad5d64b9
fix: use correct bits
Turns out the 32bit tests were actually using 64bit Godot and testing
the 64bit binaries.

This commit ensures that the tests use the correct builds and adds
32bit linux to the gdextension file.
2024-03-30 20:49:15 +13:00
Leroy Hopson
d7c83b3fe9
chore(tidyup): remove old unused code
This code was left around for reference during development, but is no
longer used or needed.
2024-03-30 02:19:01 +13:00
Leroy Hopson
1d2898f6ab
chore(spelling): add codespell pre-commit hook
Fixes spelling mistakes identified by it.
2024-03-30 01:27:28 +13:00
Leroy Hopson
0bd0d39f41
feat(pty): add cols/rows methods and resize tests 2024-03-29 01:27:42 +13:00
Leroy Hopson
d00a31fb45
feat(term): implement clear() method
Clears all but the bottommost row of the terminal (including scrollback
buffer) and moves the bottommost row to the top.
2024-03-03 22:39:51 +13:00
Leroy Hopson
71df1e71bd
feat(term): implement copy_all()
Implements the copy_all() method which copies all text in the screen
including text in the scrollback buffer.

Includes a fix to an upstream bug in libtsm that resulted in double the
number of '\n' characters being copied for each row.
2024-03-03 21:04:42 +13:00
Leroy Hopson
13cf5ba023
feat(term): implement copy_selection()
Implements the copy_selection() method, which returns the selected text.

Adds a copy_on_selection property. When this property is enabled, the
selected text will automatically be copied to the primary clipboard
(Linux X11/Wayland only).
2024-03-03 21:04:16 +13:00
Leroy Hopson
7f03761fb2
fix(pty): remove non-portable signal enums
Remove signal enum members which do not use portable numbers, and
therefore may be different on different operating systems.
2024-03-03 21:04:16 +13:00
Leroy Hopson
b78bdf3136
feat(pty): rename get_pts() -> get_pts_name() 2024-03-03 21:04:16 +13:00
Leroy Hopson
c6609ebae5
feat(compat): make compatible with godot v4.2+
Previously the plugin could only be used with v4.2.1. This commit
extends support support back to v4.2.0.
2024-03-03 21:04:10 +13:00
Leroy Hopson
cb86cc95d7
fix(pty): use double, not float, for blink times
Changes blink_on_time and blink_off_time to use double rather than
float. When float was used, the default blink_off_time of 0.3 was being
converted to 0.30000001192093 in GDScript.
2024-03-03 15:41:27 +13:00
Leroy Hopson
481a1cb04a
fix(pty): create a loop per pty
Prevents segmentation faults due to several threads trying to run the
same (default) loop.
2024-03-03 00:15:07 +13:00
Leroy Hopson
a0c9777264
feat(pty): add multithread support
Adds the option `use_threads` to PTY (enabled by default) which improves
performance when enabled. For example, running `time cat file.txt` where
file is ~4.5MB will take ~0.250s with threads enabled, versus >20s when
disabled.
2024-03-02 22:49:48 +13:00
Leroy Hopson
46f3aa12bf
chore(ci): enable debug symbols for debug builds
Exclude Windows as it leads to a "warning LNK4099: PDB '' was not found
with 'constants.windows.template_debug.x86_64.obj' or at ''" error on
subsequent runs.
2024-03-02 22:49:42 +13:00
Leroy Hopson
e1000adbe5
feat(pty): call _close() on NOTIFICATION_EXIT_TREE 2024-03-01 22:42:37 +13:00
Leroy Hopson
8fa7df29d3
feat(pty): rename statuses
- NONE -> CLOSED.
- CONNECTED -> OPEN.
- Remove CONNECTING.
2024-03-01 22:35:47 +13:00
Leroy Hopson
80ae0020da
chore(style): change indentation 2024-03-01 22:31:53 +13:00
Leroy Hopson
39b5614f61
feat(pty): use process internal, not _process 2024-03-01 20:28:03 +13:00
Leroy Hopson
a1be7fb4c3
chore(style): make variable names consistent
Makes the Terminal::_set() variable names consistent with the header
file and the _get() and _get_property_list() methods.
2024-02-27 22:12:29 +13:00
Leroy Hopson
a596b41bc3
feat(term): make 'cols' and 'rows' read-only
Removes the set_cols() and set_rows() method. The read-only properties
are still visible in the editor inspector.
2024-02-27 22:12:07 +13:00
Leroy Hopson
84e1126824
feat(pty): enable resize and resizev 2024-02-25 23:17:45 +13:00
Leroy Hopson
1da42501af
feat(term): add "size_changed" signal
Will be emitted when the number of cols or rows changes.
2024-02-25 22:36:22 +13:00
Leroy Hopson
ee920a45fd
feat(pty): parse env so it can be used with fork
Adds method to convert env from a Dictionary to a PackedStringArray so
it can be used with fork(). Consider making env a PackedStringArray to
begin with.
2024-02-25 22:10:34 +13:00
Leroy Hopson
8cd11fdae6
fix(term): prevent double keyboard input
Disconnects the "gui_input" signal as the _gui_input() override is
working as expected now. Having this signal connected was causing it to
be called twice for every input.
2024-02-25 22:06:58 +13:00
Leroy Hopson
cf0beee0c1
feat(pty): implement "write" method 2024-02-25 21:24:53 +13:00
Leroy Hopson
988788fc68
feat(term): implement data_sent signal 2024-02-25 21:14:03 +13:00