Commit graph

350 commits

Author SHA1 Message Date
Leroy Hopson
09dc080a2e Add support for the bell "\a" character
Closes #39
2021-07-03 22:47:33 +07:00
Leroy Hopson
115521f645
Replace Gut with WAT
Gut was freezing on some integration tests. It was also entering an
infinite loop after exiting (even after closing Godot and VSCode) which
caused a `godot.log` file in app_userdata to keep growing until my hard
drive was full.
2021-07-03 21:49:24 +07:00
Leroy Hopson
39702646dc
Add namespace
Adds a globally unique namespace `GDXterm` that can be used to
conveniently access scripts.
2021-07-03 20:45:11 +07:00
Leroy Hopson
964af715d6 Enable Windows 32bit builds
Closes #24
2021-07-03 16:15:18 +07:00
Leroy Hopson
0dd2378387 Add new PTY node (replaces Pseudoterminal node)
Uses fork of node-pty native code for forking pseudoterminals.
Uses libuv pipe handle to communicate with the child process.

- Paves the way for cross-platform (Linux, macOS and Windows) support.
- Renames Pseudoterminal to PTY (which is much easier to type and spell :D).
- Better performance than the old Pseudoterminal node. Especially when
  streaming large amounts of data such as running the `yes` command.
- Allows setting custom file, args, initial window size, cwd, env vars
  (including important ones such as TERM and COLORTERM) and uid/gid
  on Linux and macOS.
- Returns process exit code and terminating signal.
2021-07-03 14:56:27 +07:00
Leroy Hopson
bfa561357e Yield for "frame_pre_draw" signal before writing to terminal
Fixes #41. But creates another issue where sometimes the yield will
resume after the terminal node has already been freed logging an error
to the console.

Also a few changes to where update is called it the gdnative terminal
code.

Also changed gdnative terminal to only accept strings.
2021-07-03 14:56:27 +07:00
Leroy Hopson
4e6715329a Clang-format node-pty files 2021-07-03 14:56:27 +07:00
Leroy Hopson
9c20579bc6 Add original files from the node-pty project
Taken from <https://github.com/microsoft/node-pty>.
See the LICENSE.md file added in this commit for license and copyright
information.
2021-07-03 14:56:27 +07:00
Leroy Hopson
5a290e927a
Add gd-plug and Gut addons
Fresh clones of this repo will need to install Gut using
gd-plug:
```
godot --no-window -s plug.gd install
```
Similar to how git submodules also need to be installed.
2021-07-03 01:58:58 +07:00
Leroy Hopson
3759d3a0b9
Don't register TPut util as a global unique class 2021-07-03 01:24:07 +07:00
Leroy Hopson
ca7def60e8
Don't cancel all in-progress jobs if a single one fails
It is useful to get results from all jobs, whether or not a single one
fails.
2021-07-03 01:17:02 +07:00
Leroy Hopson
c262ea8113
Add example of using GodotXterm with socat
Uses OS.execute to start socat with a tcp server on one end and shell on
te other.
Connects to the socat server using StreamPeerTCP.
Doesn't support reszing and inherits 'dumb' for the TERM env var so
doesn't work too well without updating TERM and resizing with stty.
2021-07-03 00:55:16 +07:00
Leroy Hopson
0c43776619
Load default theme if it exists
This also means that we can load default fonts from it. Falling back to
the default Godot font if no theme is set and the default theme does not
exist.

Having an actual theme loaded also allows live font resizing.
2021-06-22 21:45:55 +07:00
Leroy Hopson
a5776989b4
Change default font and reduce size
Changes default font from Cousine -> Hack which is the font used in
Godot's script editor and output terminal.

Also reduced the size from 16 -> 14.
2021-06-22 21:45:55 +07:00
Leroy Hopson
4b73c958c0
Ensure libtsm uses correct version of wcwidth
Previously it was using some other linked version, not the one in
thirdparty/libtsm/external/wcwidth.
2021-06-22 21:45:55 +07:00
Leroy Hopson
a337143949 Add libtsm patches for some escape sequences
The sequences are:
  CSI > Pp ; Pv m    (e.g. '\e[>4;m'
  CSI ? Pm $ p       (e.g. '\e[?12$p'

These sequences were being output by vim and causing the underline
attribute to be set and the terminal to be reset.

Fixes #40
2021-06-22 00:07:13 +07:00
Leroy Hopson
d2f073d7ae
Multiple updates
- Use viewport as render target for terminal:
  Terminal now only draws cells which changed since the last _draw() call.
  A viewport is used with clear mode set to NEVER to cache previous draw
  calls. The terminal node and viewport are wrapped by a GDScript Terminal
  node which takes care of resizing the viewport scene, and forcing the
  terminal to redraw all cells when necessary (i.e. on resize or theme
  change).

  Adds update_mode to terminal interface which can be set to one of:
  - DISABLED: terminal will never be drawn
  - AUTO: terminal will only draw the cells that changed, but
    automatically redraw the full screen when necessary (for example,
    when the size or theme changed).
  - ALL: terminal will always draw every cell on every update. This is
    the most reliable but least performant option.
  - ALL_NEXT_FRAME: Will use update_mode ALL for the next _draw() call,
    then change update_mode back to AUTO.

- Upgraded libtsm:
  Includes changes from Fredrik Wikstrom (salass00)'s fork of libtsm.

- Don't require theme to be set.
  Terminal will use default fonts/colors if no theme is set.
2021-06-20 18:33:40 +07:00
Leroy Hopson
3dd89ec0a7
Add example vscode files 2021-06-20 13:59:50 +07:00
Leroy Hopson
bd296364d3
Remove unused/debug code 2021-06-19 20:30:43 +07:00
Leroy Hopson
03f9b84b71
Be explicit about building for debug target 2021-06-19 19:44:11 +07:00
Leroy Hopson
0743f2a97a
Use gdnative api to get constants only for javascript platform
When trying to load the library in a non-Mono Godot editor v3.3.2
an error is printed about godot_get_global_constants(). Furthermore,
the issue with using the GlobalConstants header to get constants is only
present on the javascript platform, so we can revert all other platforms
to the old way of getting constants.
2021-06-19 19:39:20 +07:00
Leroy Hopson
302bdf0714
Format .gd files and fix gdformat pre-commit hook
Previously this hook was not being run.
2021-06-19 18:02:07 +07:00
Leroy Hopson
80bcc41855
Save themes in .tres format
Better for version control and editing outside of the editor.
2021-06-18 10:17:48 +07:00
Leroy Hopson
b133bfb602
Ignore mono_crash.* files 2021-06-18 09:44:25 +07:00
Leroy Hopson
3fb2580fc6
Build scripts: check if submodule directories are empty
In a freshly cloned repo, submodule directories exist but are not
empty. Check if they are empty and update submodules. Previously,
submodules where only updated if their directories did not exist.
2021-06-15 14:14:48 +07:00
Leroy Hopson
bdda1458c0
Update files for javascript build and export
Adds some files to making building and export for HTML5 more convenient.
2021-06-15 14:02:40 +07:00
Leroy Hopson
2f4cbacf15
Git modules (squash later) 2021-06-15 14:02:40 +07:00
Leroy Hopson
c1334896d6
Explicity check not javascript when including pseudoterminal
If compiling for javascript platform on linux '__unix__' will be defined,
so instead check for the abscence of '__EMSCRIPTEN__'.
2021-06-15 14:02:01 +07:00
Leroy Hopson
0437d0f18c
Rename directory 'external' -> 'thirdparty' 2021-06-12 15:10:42 +07:00
Leroy Hopson
9e8bc713e7
Run workflow on all push and pull events 2021-06-08 23:02:41 +07:00
Leroy Hopson
caf3bf1910
Use standard OS macros
As per: https://sourceforge.net/p/predef/wiki/OperatingSystems/
2021-06-08 22:59:12 +07:00
Leroy Hopson
bb8d40df58 Add HTML5 support 2021-06-07 18:29:33 +07:00
Leroy Hopson
fbb23661d3 Get KeyList constants from GDNative API
Previously KeyList constants came from the GlobalConstants.hpp header,
but this did not work when compiling for HTML5. Therefore, we now get
the globals constants from the GDNative API.

Throws the error:
`LNK2019: unresolved external symbol godot_get_global_constants referenced in function "private: static void __cdecl godot::Terminal::_populate_key_list(void)" (?_populate_key_list@Terminal@godot@@CAXXZ)`
in GitHub Windows action. So use the old technique on Windows for now.

This is a prerequisite for HTML5 support.
2021-06-06 21:57:06 +07:00
Leroy Hopson
6e455738b8 Format c++ files using clang-format
Add git pre-commit hooks to help with automatic formatting.
2021-06-06 20:05:22 +07:00
Leroy Hopson
99989d19e4 Update godot-cpp 2021-06-06 17:19:24 +07:00
Leroy Hopson
f43149f204 Format files using GDScript Toolkit
https://github.com/Scony/godot-gdscript-toolkit
2021-06-06 16:25:19 +07:00
Leroy Hopson
a0237bb5d5 Add more themes 2020-11-30 11:24:34 +07:00
Leroy Hopson
472f0f573b Add transparency support for theme colors
Closes #19.
2020-11-29 15:53:50 +07:00
Leroy Hopson
3e177b781e Set a default theme if theme property is not set
This means that the terminal is no longer blank if no theme has been
set.
2020-11-29 15:53:50 +07:00
Leroy Hopson
8b25be74c0 Don't swap red and blue channels of theme colors
Fixes #18
2020-11-29 13:32:14 +07:00
Leroy Hopson
6a626905d6 Use "Light Cyan" color from theme
Previously this color was ignored.
2020-11-29 13:32:14 +07:00
Leroy Hopson
b55f96cb70 Bump version to 1.2.1 2020-11-23 16:20:41 +07:00
Leroy Hopson
69326b11bb
Remove version badge from README 2020-11-23 10:56:32 +07:00
Leroy Hopson
a71df27bab Upload separate debug and release artifacts 2020-11-23 09:13:32 +07:00
Leroy Hopson
55e2e0cc8b Install scons using pre-installed python
This should be faster than installing python via chocolatey.
2020-11-23 09:13:32 +07:00
Leroy Hopson
4cc2115125 Build windows releases with /MT rather than /MD
When making a release export of a project, binaries built with the /MD
flag do not work.
2020-11-23 09:13:32 +07:00
Leroy Hopson
c99a9b4a2e Remove docker builds
They are too slow and don't really test anything special.
2020-11-23 09:13:32 +07:00
Leroy Hopson
bdbc82e444 Update CHANGELOG, README and bump version 2020-11-21 19:44:43 +07:00
Leroy Hopson
6689ad1c09 Remove cross-compilation dependencies
It makes the github actions workflow take longer and cross-compiled
artifacts are not currently used (nor do they seem to work).
2020-11-21 19:44:43 +07:00
Leroy Hopson
570896b9c0 Provide correct arguments to execvp
Previously no arguments were provided, but by convention argv[0] should
be the name of the program.

Providing this argumens enables Psuedoterminal node to work on macOS.
2020-11-21 13:55:05 +07:00