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.
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".
- 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.
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.
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.
- Primary example scenes (menu, terminal, and asciicast) working but
still a lot of warning/error messages and some regressions.
- Editor integrated terminal works, but still a lot of warning/error
messages and some regressions.
- Added support for "blink" display attribute.
- Removed GDScript terminal code. Terminal node is now purely a
GDExtension. So is LibuvUtils.
- GUT tests not working yet.
- Still a lot of things to fix.
- So far, only built for and manually tested on Linux x86_64.
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.
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.
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.
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.
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.