Commit graph

242 commits

Author SHA1 Message Date
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
Leroy Hopson
14288352fd
fix(term): address clang warnings 2024-02-25 20:53:09 +13:00
Leroy Hopson
05b19c1336
feat(term): implement "key_pressed" signal
Also adds tests for write response as code relating to this was
modified.
2024-02-25 20:25:32 +13:00
Leroy Hopson
c36500615d
feat(pty): further pty development 2024-02-25 17:55:31 +13:00
Leroy Hopson
1514f42b54
feat(pty): add initial pty node 2024-02-25 11:48:47 +13:00
Leroy Hopson
4771a3c9a7
Fix rendering according to test 2024-02-18 20:31:08 +13:00
Leroy Hopson
6d112ca0f2
Add method get_cell_size() 2024-02-18 20:24:31 +13:00
Leroy Hopson
685884965e
Fix bell behaviour according to tests 2024-02-18 20:24:27 +13:00
Leroy Hopson
dc97c56b17
Use type Vector2i for get_cursor_pos()
Cursor position is always integer.
2024-02-18 14:06:30 +13:00
Leroy Hopson
0ccc539f36
Prevent creation of orphan Timer 2024-02-18 14:06:30 +13:00
Leroy Hopson
2b5ea392bf
Free fore_canvas_item
Frees fore_canvas_item in cleanup, preventing RID allocation leak.
2024-02-18 14:06:30 +13:00
Leroy Hopson
db3564f0cc
Setup tests
- Install Gut using gd-plug.
- Add some basic tests.
- Update workflow to run tests.
- Add test and gd-plug install/uninstall recipes to Justfile.
- Re-enable debug builds as these are used by editor when testing.
2024-02-18 14:06:25 +13:00
Leroy Hopson
e234b14867
Only register/remove Terminal once 2024-02-18 12:50:21 +13:00
Leroy Hopson
3bed9e7b0f
Add scroll support 2024-02-15 18:54:20 +13:00
Leroy Hopson
d59a925ca1
Add selection support 2024-02-15 07:27:51 +13:00
Leroy Hopson
3fcaa79f6e
Add support for key input 2024-02-15 06:53:53 +13:00
Leroy Hopson
580760ffad
Move other constants to constants file 2024-02-14 20:00:13 +13:00
Leroy Hopson
0a1ba5abcd
Add KEY_MAP constant 2024-02-14 19:46:29 +13:00
Leroy Hopson
420c774a43
Re-enable native builds 2024-02-13 20:34:47 +13:00
Leroy Hopson
aa2b93248e
Perform GDScript format checks using pre-commit 2024-02-13 11:27:07 +13:00
Leroy Hopson
002e7aacc7
Auto-format files using new pre-commit config 2024-02-13 10:52:22 +13:00
Leroy Hopson
58f4f8f216
Initialize background image to background color 2024-02-10 22:51:11 +13:00
Leroy Hopson
b8431e4a93
Always erase previous cell
Even if we are not drawing a new character in the cell, we should erase
the old one.
2024-02-10 22:49:47 +13:00
Leroy Hopson
8e5fbe72cd
Support background and attributes for wide chars
Supports setting background color and attributes for wide characters
(i.e. more than 1 cell wide). Previously only the first cell had its
background and attribute set.
2024-02-10 22:49:10 +13:00
Leroy Hopson
fd2c33c486
Re-add bell support 2024-02-10 22:03:43 +13:00
Leroy Hopson
07687e2cd8
Return terminal responses from write method
Updates the `write()` method to return a String containing any responses
from the terminal. For example, these could be responses to a cursor
position request such as "\u001b[6n".
2024-02-10 21:10:54 +13:00
Leroy Hopson
9fde38045a
Support rendering of more than just ASCII characters 2024-02-10 21:08:34 +13:00
Leroy Hopson
3f24fa9bf0
Handle multiple font styles
Adds support for font styles other than normal, such as bold, italics,
and bold italics.
2024-02-10 17:15:44 +13:00
Leroy Hopson
fb3fb6855c
Make intentionality of switch fallthrough clear 2024-02-10 16:36:48 +13:00
Leroy Hopson
6b1c9d818a
Rename enum AttrFlags -> AttrFlag 2024-02-10 15:53:03 +13:00
Leroy Hopson
f4c80e6201
Use custom libtsm version sans problematic commit
Use updated custom version of libtsm without commit which causes strange
behavior when rezining the Terminal control node.
2024-02-10 00:51:15 +13:00
Leroy Hopson
575c3875b6
Implement get_cursor_pos() 2024-02-07 23:14:52 +13:00
Leroy Hopson
8c30bec861
Add support for two different inverse modes
- Inverse mode invert (default) will invert the color in shader.
- Inverse mode swap will simply swap the foreground and background
  colors. This is the default behavior of libtsm and GodotXterm v3.
2024-02-07 23:03:11 +13:00
Leroy Hopson
930f3ef352
Expose blink_on_time and blink_off_time properties 2024-02-07 22:26:45 +13:00
Leroy Hopson
7de5e2a835
Restore terminal.gd for referencing 2024-02-07 22:03:41 +13:00
Leroy Hopson
8b320622f9
Use shader include for fore/background shaders
The two shaders use a lot of common logic for co-ordinate and attribute
look up, so it makes sense to use a common include shader for both.

Adds support for the inverse and blink attributes to the foreground shader.
2024-02-07 21:59:01 +13:00
Leroy Hopson
a849423096
Rewrite terminal.cpp
Rewrites the Terminal class as a GDExtension to be used directly in
Godot without a terminal.gd proxy.

Breaks a lot of things in its current state (e.g. signals and other
functions have not be implemented yet), but does add support for
transparent colors and true color inversion. It also seems to
be about 4x faster (FPS-wise) than the old version with some basic
stress testing.

Old source code has been moved to a different directory to be copied
over and/or rewritten piece by piece.
2024-02-07 00:14:33 +13:00
Leroy Hopson
7d2e22530e
Update libtsm 2024-02-06 23:56:21 +13:00
Leroy Hopson
14db14679f
chore: add .import files 2024-02-06 23:56:06 +13:00
Leroy Hopson
f694544834
Remove unused code 2024-01-07 11:07:20 +13:00
Leroy Hopson
33ca5b3af7
Change build options
- Removes --disable-pty build option.
- Sets debug_symbols="yes" when build target is debug.
2024-01-07 11:06:26 +13:00
Leroy Hopson
cea41d6567
Update GUT to version 9.1.1 2024-01-06 23:33:15 +13:00
Leroy Hopson
b18726eac9
Pin nixpkgs version 2024-01-06 23:22:39 +13:00
Leroy Hopson
fac6361898
Upgrade min compatible Godot version to 4.2.1 2024-01-06 23:22:34 +13:00
Leroy Hopson
52a89827c9
Allow script loading when compiled with PTY_DISABLED 2024-01-06 23:16:52 +13:00
Leroy Hopson
893c768f75
Update gdtoolkit to version 4.2.2 2024-01-06 23:11:04 +13:00
Leroy Hopson
11ed797005
Update godot-cpp to match Godot v4.0-rc1 API
Usage of VARIANT_ENUM_CAST has changed.
2023-02-12 10:53:34 +13:00