Commit graph

176 commits

Author SHA1 Message Date
Leroy Hopson
b5d3c6c9a5
Update Gut for Godot 4
Copied from Gut repo godot_4 branch commit:
ba19a4c1b6f88160641a67a39729144046c6391f
2023-01-08 21:36:37 +13:00
Leroy Hopson
44f7e3801c
Convert from GDNative to GDExtension
Work in progress.
2022-12-29 22:54:38 +13:00
Leroy Hopson
6b47d35835
Update import plugins 2022-12-28 11:52:19 +13:00
Leroy Hopson
4490296d4d
Update .import files 2022-12-28 11:43:36 +13:00
Daniel Inkpen
5c39a8071f Probably some progress 2022-11-09 22:29:11 +00:00
Daniel Inkpen
b1ec881c8c First open project in Godot 4 2022-11-09 21:58:07 +00:00
Daniel Inkpen
099100d3e0 Reverse most obvious mistakes from Godot 4 automatic changes 2022-11-09 21:52:54 +00:00
Daniel Inkpen
cdbf3f2adc Godot 4 automatic changes 2022-11-09 20:57:46 +00:00
Leroy Hopson
9435502c8d
Statically link libstdc++
Otherwise binaries build on GitHub Actions fail to load on NixOS as
dynamically linked libstdc++ cannot be found.
2022-08-27 20:45:41 +12:00
Leroy Hopson
cceffd4edf
Use load() rather than preload() for terminal icon
Allows the plugin to load even if resources have not been imported yet.
For example, if someone has opened a project with the plugin for the
first time. Otherwise, the plugin will fail to load and be disable in
the `project.godot` file.
2022-08-27 10:32:27 +12:00
Leroy Hopson
10b9764fb3
Use default export templates for HTML5
Changes Emscripten SDK version to match that used to compile the default export
templates used by Godot 3.5 (in this case 3.1.14 as can be seen here:
https://github.com/godotengine/build-containers/blob/3.5/Dockerfile.javascript).

This means we no longer need to compile custom export templates when
exporting HTML5 for Godot 3.5. Exports from other Godot versions may
requiring compiling the GDNative library with a different version of the
Emscripten SDK.

- Changes renderer from GLES3 -> GLES2 and reduces MSAA level to better
  support HTML5 export.
- Updates GitHub Action to export HTML5 and upload as a build artifact.
- Adds Cypress test to smoke test HTML5 export.
2022-08-27 10:32:22 +12:00
Leroy Hopson
94df3faa69
Automatic theme updates
Performed after opening and saving the files in the editor without
making any changes.
2022-08-26 16:53:07 +12:00
Leroy Hopson
9765e94889
Change target Godot version to v3.5-stable
Upgrade setup-godot action from v1 -> v2 which changes default Godot
version from 3.4 -> 3.5.
2022-08-26 16:53:02 +12:00
Leroy Hopson
002fcf3b78
Remove deprecated cols/rows properties of Terminal 2022-08-26 14:50:24 +12:00
Leroy Hopson
8d656d8c71
Remove deprecated get_master() method of PTY 2022-08-26 12:35:54 +12:00
Leroy Hopson
b2f190d29a
Remove support for deprecated theme item names 2022-08-26 12:30:07 +12:00
Leroy Hopson
7e65be4cf9
Fix typo in deprecated color name 2022-08-26 12:23:39 +12:00
Leroy Hopson
4f24f2bd37
Bump version to 2.2.0 2022-08-26 10:02:09 +12:00
Leroy Hopson
95b66115c4
Update/deprecate theme item names
Updates theme names to be compatible with Godot 3.5 (no spaces),
consistent with other Godot theme item names (snake_case), and
match the color names listed on the
[ANSI escape code wikipedia page](https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit).

Deprecates the old names and warns users to change them.
2022-08-26 09:28:38 +12:00
Leroy Hopson
d45ea7a3cd
Update libtsm to not erase screen on palette change
Fixes #57.
Fixes #58.
2022-08-22 22:56:50 +12:00
Leroy Hopson
41525959e1
Deprecate undocumented get_master() method
This method was never officially documented and used only as a workaround for
issue #53. It also returns an instance of the undocumented and scruffily
implemented Pipe class that I would prefer to keep internal.

Now that #53 has been fixed, this method can be removed from the unofficial
public API, but deprecate it just in case. If someone was using it then it
is still possible (although not supported) to access the `_pipe` property of
`_pty_native`.
2022-08-22 10:05:41 +12:00
Leroy Hopson
6cd5facb98
Deprecate the cols and rows properties of Terminal
As cols and rows are read only (i.e. automatically determined by rect
and font size) there is no need for the properties to be exposed.
Instead, users can get the calculated cols and rows using the get_cols()
and get_rows() methods.
2022-08-22 10:05:36 +12:00
Leroy Hopson
f49410838c
Drop support for Godot 3.3.x 2022-08-22 10:02:50 +12:00
Leroy Hopson
6e9cd130a7
Bump version to 2.1.1 2022-08-15 17:12:36 +12:00
Leroy Hopson
9ed6750b83
Fix unicode errors
Changes `write()` method of native pipe and terminal to accept a
PoolByteArray rather than String. This means that `get_string_from_utf8()`
is no longer called on data coming from PTY and being sent to Terminal.

The terminal state machine already has a UTF8 parser which maintains
its state across calls to `write()`. This means that we can write half
the bytes of a single unicode character in one call and the remaining half
in the next call and the state machine will parse it correctly.

On the other hand, the `get_string_from_utf8()` method of Godot's
PoolByteArray requires that the array contains completely valid UTF8,
otherwise we get errors such as "Unicode error: invalid skip".

The data coming from PTY can be arbitrarily split in the middle of a
unicode character meaning that we will sometimes get errors when calling
`get_string_from_utf8()` on it. This is more likely to occur when there
is a large amount of output (i.e. it's more likely to be split). In other
cases, the data might intentionally contain invalid unicode such as when
printing binary files or random data (e.g. `cat /bin/sh`, `cat /dev/random`).

We avoid these errors by passing the PoolByteArray data directly to the terminal
state machine.

In addition to fixing unicode errors, this commit:
- Prevents repeated calls to pipes `_read_cb()` method that would block Godot
  and result in a crash with the message "ERROR: All memory pool allocations
  are in use" that resulted from writing data to an ever-increasing number of
  PoolByteArrays before any of them could be freed. This could be triggered by
  running the `cat /dev/urandom` command after making the change to `write()`
  mentioned above.
- Prevents memory leaks by freeing libuv buffers after they have been copied
  to PoolByteArrays.

Fixes #55.
2022-08-15 17:09:29 +12:00
Leroy Hopson
054c7c9ad4
Ensure initial PTY size matches Terminal (if any)
If a PTY has a terminal_path set to a valid Terminal, then ensure that
the initial cols and rows of PTY match the cols and rows of the Terminal
when calling fork() or open(), otherwise PTY will output wrong-sized
data for the Terminal until resized.

Fixes #56.
2022-08-15 17:09:25 +12:00
Leroy Hopson
041e7a445f Request redraw after write if terminal visible
Requests a redraw after writing to terminal if it is visible, otherwise
terminal will not be updated if there are no other redraw requests.

Fixes #53.
2022-08-08 10:13:53 +12:00
Leroy Hopson
9896a362c3
Automatic editor updates
Automatic updates applied to scenes after opening in Godot editor
v3.4.4-stable.
2022-08-06 20:32:58 +12:00
Leroy Hopson
d558b07fd4 Prevent loss of focus on Tab/Arrow key press
Prevents Terminal losing focus when in a scene with other inputs and
the Tab or Arrow keys are pressed.

Fixes #51.
2022-08-05 10:55:24 +12:00
Leroy Hopson
8a3adbbe68
Fix GitHub Actions godot-cpp-linux Docker build 2022-08-03 22:41:12 +12:00
Leroy Hopson
3b7bdfc5ca
Bump version to 2.1.0 2022-07-11 09:33:01 +12:00
Leroy Hopson
df32ee3c18
Refactor PTY
PTY now provides a public interface to an underlying instance of
PTYNative. The PTYNative class can be extended as appropriate for
each platform and the platform-specific implementation will be
selected by PTY at runtime.
2022-07-11 09:33:01 +12:00
Leroy Hopson
b76f8d0939
Prevent scrollback buffer reset when using copy shortcut
Prevents scrollback buffer reset (i.e. scrolling to the bottom of
terminal output) when pressing modifier keys in isolation or when
copying text using the shortcut Ctrl+Shift+C.
2022-07-11 09:33:01 +12:00
Leroy Hopson
cf613708c4
Fix resume after yield error
Fixes error that would sometimes occur when closing the Terminal after
calling write() but before the VisualServer had finished drawing the
current frame.
2022-07-11 09:33:01 +12:00
Leroy Hopson
0ae1d80abb
Prevent exit callback instance leaks
De-references pty_baton's exit callback after it is called so it can be
automatically released, preventing leaked instances.

Adds basic implementation for Pipe's get_status() method and forces PTY
to wait for child process to exit to ensure exit callback is cleaned up.

Adds a test to check that exit callback is still called as usual.
2022-07-11 09:33:01 +12:00
Leroy Hopson
d784b53e25
Add GUT (CLI only) and remove gd-plug
Commit GUT directly to the git repo and remove gd-plug as it is no
longer required to install GUT.

Modify GUT to be used by command-line only.

For example:
```
cp test/.gutconfig.ci.json .gutconfig.json
godot --no-window -s addons/gut/gut_cmdln.gd
```
2022-07-11 09:33:00 +12:00
Leroy Hopson
6ec3c93c55
Prevent editor shortcuts while terminal is focused 2022-07-11 09:33:00 +12:00
Leroy Hopson
bea5d1c27d
Check if baton FuncRef is valid before calling call_funcv()
Often when closing a terminal in the terminal panel the error message
'Condition "!obj" is true.' would be printed to console.

This was due to the call_funcv() method being called on an invalid
FuncRef instance (invalid because it had already been deleted or queued
for delection).

Now we check the instance is valid before calling the method.
2022-07-11 09:33:00 +12:00
Leroy Hopson
d124f20f36
Remove custom TerminalSettings Resource type
There is no current public use for this type and it would appear in every
resource dropdown.

While this type is no longer exposed publically by the plugin it is still
used internally by terminal_panel.
2022-07-11 09:33:00 +12:00
Leroy Hopson
f0bd70cb3e
Update target Godot version: 3.3.2-stable -> 3.4.4-stable
Also apply automatic updates to .import files after opening project in
3.4.4 editor.
2022-07-11 09:33:00 +12:00
Leroy Hopson
3fdc9ef27e
Add Docker build for Linux
Adds support for building Linux binaries inside a docker container in
order to target an older version of GLIBC.

Updates GitHub Actions workflow to use it.

As a result the minimum version of GLIBC that Linux users need to have
installed on their system is 2.17 which was released in 2012.
2022-07-11 09:33:00 +12:00
Leroy Hopson
1d51acb38d
Register pipe.close() method
Allows kill() method of unix PTY node to be called without error.
2022-07-11 09:33:00 +12:00
Leroy Hopson
57dadf7db2
Support universal (x86_64/arm64) builds for macOS
The macOS binary (libgodot-xterm.osx.64.dylib) is now a universal binary
that runs natively on both x86_64 and arm64.
2022-07-11 09:33:00 +12:00
Leroy Hopson
deb68e323c
Reformat existing gdscript code 2022-07-11 09:33:00 +12:00
Leroy Hopson
0ccac28cc6
Update godot-cpp submodule
- We now need to include `<string>` in `terminal.cpp`.
- Clean-up `.gitmodules` while we're at it.
2022-05-31 18:34:51 +07:00
Leroy Hopson
99c3b1b452
Automatic editor updates v3.4.4-stable
- Add `.import` files automatically updated after opening project in new
  target version of the editor.
2022-05-31 18:34:51 +07:00
Leroy Hopson
2a9ecb524e
Bump version to 2.0.0
How it started...
```gdscript
extends TextEdit
```
How it's going...
```c++
```
2021-07-26 00:56:54 +07:00
Leroy Hopson
9d15420df3
Move terminal.gd and pty.gd to godot_xterm directory
Makes for pretty paths when extending scripts:
`extends "res://addons/godot_xterm/terminal.gd"`
vs.
`extends "res://addons/godot_xterm/nodes/terminal/terminal.gd"`

Currently "res://addons/godot_xterm/pty.gd" is acutally `pty_unix.gd`.
This is okay for now as the PTY node is only supported on Unix
platforms. However, we will need to sort it out when adding Windows
support as part of #25.

Also remove the GDXterm namespace.
2021-07-26 00:39:48 +07:00
Leroy Hopson
e6db81615e
Automatic .tscn file updates
Automatically changed by the editor.
2021-07-25 23:09:37 +07:00
Leroy Hopson
082ce8f199
Use only default settings for terminal panel
Until settings have been properly defined, documented and implemented.
2021-07-25 23:09:37 +07:00