Commit graph

134 commits

Author SHA1 Message Date
Leroy Hopson
284fd9b6d3
Add linguist override to identify .gd files as GDScript rather than GAP 2021-07-16 18:36:24 +07:00
Leroy Hopson
30807f1436
Use relative rather than absolute paths
This should allow GodotXterm be installed in locations other than
`addons/godot_xterm`.
2021-07-15 21:30:09 +07:00
Leroy Hopson
18d25579fd
Add script to build HTML5 export 2021-07-15 19:35:46 +07:00
Leroy Hopson
7c6300c8dc
Close terminal on successful exit 2021-07-15 19:33:59 +07:00
Leroy Hopson
ec0d4ddf43
Add popup label to show terminal and panel size on resize
Shows the terminal cols/rows (if a terminal is open) and the size of the
the tab_container in pixels. Shows centered for 1 second, then closes.
2021-07-13 23:34:24 +07:00
Leroy Hopson
de7980c077
Add next/previous tab shortcuts 2021-07-13 22:49:48 +07:00
Leroy Hopson
97e07093b2
Change terminal menu option 'Select All' -> 'Copy All'
Adds copy_all() function to terminal node which returns all of the
screen's text.
2021-07-13 22:20:29 +07:00
Leroy Hopson
703eb68f11
More shortcuts
- Copy
- Paste
- Kill
2021-07-13 16:43:51 +07:00
Leroy Hopson
6106b7f100
Disable default copy on selection 2021-07-13 08:53:15 +07:00
Leroy Hopson
658197f44c
Enable drag to rearrange tabs 2021-07-13 08:51:11 +07:00
Leroy Hopson
8b3c207b0c
Set new terminal shortcut input as handled
Otherwise the input will also be handled by the newly spawned terminal
and ^T will be printed to the screen.
2021-07-13 08:38:50 +07:00
Leroy Hopson
bbe6cb273b
Set terminal panel tabs close button policy to CLOSE_BUTTON_SHOW_ALWAYS
Temporary measure until we can resolve the issue where inactive tabs
would be closed when clicking on the area where the close button will
show when policy was CLOSE_BUTTON_SHOW_ACTIVE_ONLY.
2021-07-13 08:36:49 +07:00
Leroy Hopson
6afaa55914
Move bell to main terminal 2021-07-13 08:16:34 +07:00
Leroy Hopson
e8c27f2796
Add clear and sb_reset
Clearing the terminal removes all lines in the scrollback buffer except
for the most recent.

With sb_reset, the terminal will return the scrollback buffer to the
bottom when the user starts typing if they have previously scrolled up.
2021-07-13 06:33:44 +07:00
Leroy Hopson
ebb527cb8b
Terminal panel updates
- Add TerminalSettings resource.
- Init/load terminal settings from terminal panel.
- Add terminal context menu (i.e. right-click PopupMenu).
- Add shortcut to open a new terminal Ctrl+Shift+T and make terminal panel
  visible.
2021-07-12 23:13:33 +07:00
Leroy Hopson
04e077694f
Move bell sound to themes directory 2021-07-12 22:55:57 +07:00
Leroy Hopson
e13bc7e082 Draw wide characters correctly
Draw the full background for wide characters as soon as they are
encountered. Don't draw any foreground or background if width is zero as
this means the previous character was wide.

Fixes #17
2021-07-12 22:46:43 +07:00
Leroy Hopson
683b0e3304 Editor terminal use default theme fonts 2021-07-12 22:46:43 +07:00
Leroy Hopson
c5d4a363b8 Add Nerd Fonts, Noto Color Emoji, and Unifont as fallback fonts 2021-07-12 22:46:43 +07:00
Leroy Hopson
84702af851 Rename hack font files 2021-07-12 22:46:43 +07:00
Leroy Hopson
4c4b71ee57 Add Nerd Fonts license information 2021-07-12 22:46:43 +07:00
Leroy Hopson
2f21671adf Revert "Delete nerdfonts"
This reverts commit 29ff3efc49.
2021-07-12 22:46:43 +07:00
Leroy Hopson
221053bb51
Add missing gd-plug LICENSE 2021-07-11 23:34:08 +07:00
Leroy Hopson
5e25ebbab6 Add rudimentary terminal to editor's bottom panel
In order to use the gdnative library as an editor plugin it was
neccessary to set the `reloadable` property of the gdnlib file to false,
in order to prevent crashes when the godot editor window lost focus.

This may have consequences when recompiling the library.
See: https://docs.godotengine.org/en/3.3/classes/class_gdnativelibrary.html#class-gdnativelibrary-property-reloadable

Still crashes quite frequently and doesn't close child processes
properly.

Part of #43.
2021-07-11 23:03:33 +07:00
Leroy Hopson
33e4640b4b Remove visibility notifier from terminal
It seems unnecessary when testing outside of editor and causes the
terminal to render the wrong colors in editor.
2021-07-11 23:03:33 +07:00
Leroy Hopson
f48e082b54 Reformat code causing clang-format clashes
VSCode and the clang-format git hook disagreed about how this one should
be formatted, so it kept changing.
2021-07-11 23:03:33 +07:00
Leroy Hopson
0e6334db96 Add copy selection support 2021-07-11 23:03:33 +07:00
Leroy Hopson
57c1c3524d Add basic pointer selection
Part of #4.
2021-07-11 23:03:33 +07:00
Leroy Hopson
fae28006cf Move scroll handling to GDScript
Just expose the underlying libtsm methods from gdnative, but write all
the logic in gdscript. Makes it much easier to customize and update.
2021-07-11 23:03:33 +07:00
Leroy Hopson
748941f7ff
Don't run GitHub actions on pull_request
This is already covered by push, so we can prevent running jobs twice.
2021-07-07 22:12:36 +07:00
Leroy Hopson
c95049c407
Update license information
- Renamed LICENSE -> LICENSE.md as it contains markdown, and added
  contact address.
- Adds THIRDPARTY_NOTICES.txt and THIRDPARTY_NOTICES_nopty.txt which
  bundles licenses of all third-party components for versions of
  GodotXterm compiled with and without PTY node support.
- Adds misc/gen_3rdparty_licenses.sh file to generate the above
  mentioned text files.
- Seperated node_pty and tmux licenses.
- Updated libuv submodule to use version that contains additional license
  information.
- Updated README to reflect these changes.
2021-07-07 21:39:54 +07:00
Leroy Hopson
5838b7fe7e
Add support for mouse scroll
Part of #4.
2021-07-07 21:36:24 +07:00
Leroy Hopson
44ea56aa0f
Add disable_pty compile option
If disable_pty=yes then the PTY node and dependencies (LibuvUtils, Pipe)
will be excluded. On platforms where the PTY node is not supported (e.g.
HTML5), this will always be equivalent to `disable_pty=yes`.
2021-07-07 21:32:26 +07:00
Leroy Hopson
29ff3efc49
Delete nerdfonts
It is not used and we don't have license information for it.
2021-07-07 21:32:26 +07:00
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