mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-10 04:40:25 +01:00
Add pre-commit config and auto-format files
This commit is contained in:
parent
af16cb8653
commit
bd817eb0ce
22 changed files with 370 additions and 349 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -30,6 +30,7 @@
|
|||
/.import export-ignore
|
||||
/LICENSE.md export-ignore
|
||||
/misc export-ignore
|
||||
/.pre-commit-config.yaml export-ignore
|
||||
/project.godot export-ignore
|
||||
/README.md export-ignore
|
||||
/requirements.txt export-ignore
|
||||
|
|
39
.github/workflows/main.yml
vendored
39
.github/workflows/main.yml
vendored
|
@ -1,4 +1,4 @@
|
|||
name: 'Build and Test'
|
||||
name: "Build and Test"
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -14,13 +14,13 @@ env:
|
|||
|
||||
jobs:
|
||||
build_docker:
|
||||
name: 'Build Docker (linux, ${{ matrix.target }}, ${{ matrix.bits }})'
|
||||
name: "Build Docker (linux, ${{ matrix.target }}, ${{ matrix.bits }})"
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target: [ release, debug ]
|
||||
bits: [ 64, 32 ]
|
||||
target: [release, debug]
|
||||
bits: [64, 32]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -59,14 +59,14 @@ jobs:
|
|||
addons/godot_xterm/native/bin/*.so
|
||||
|
||||
build_native:
|
||||
name: 'Build Native'
|
||||
name: "Build Native"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ javascript, osx, windows ]
|
||||
target: [ release, debug ]
|
||||
bits: [ 64, 32 ]
|
||||
platform: [javascript, osx, windows]
|
||||
target: [release, debug]
|
||||
bits: [64, 32]
|
||||
include:
|
||||
- platform: javascript
|
||||
os: ubuntu-22.04
|
||||
|
@ -129,7 +129,7 @@ jobs:
|
|||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
uses: jwlawson/actions-setup-cmake@v1
|
||||
with:
|
||||
cmake-version: '3.23.2'
|
||||
cmake-version: "3.23.2"
|
||||
use-32bit: ${{ matrix.bits == 32 && matrix.os == 'windows-2022' }}
|
||||
- name: Build libuv
|
||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
|
@ -171,8 +171,8 @@ jobs:
|
|||
addons/godot_xterm/native/bin/*.dll
|
||||
|
||||
html5_export:
|
||||
name: 'HTML5 Export'
|
||||
needs: [ build_docker, build_native ]
|
||||
name: "HTML5 Export"
|
||||
needs: [build_docker, build_native]
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -202,7 +202,7 @@ jobs:
|
|||
- name: NPM cache
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
cache: 'npm'
|
||||
cache: "npm"
|
||||
cache-dependency-path: test/html5/package-lock.json
|
||||
- name: Smoke test HTML5 export
|
||||
shell: bash
|
||||
|
@ -226,15 +226,15 @@ jobs:
|
|||
path: docs/demo
|
||||
|
||||
test:
|
||||
name: 'Test'
|
||||
needs: [ build_docker, build_native ]
|
||||
name: "Test"
|
||||
needs: [build_docker, build_native]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ windows-2022, macos-12, ubuntu-22.04 ]
|
||||
bits: [ 64, 32 ]
|
||||
godot_version: [ 'v3.4.5-stable', 'v3.5-stable' ]
|
||||
os: [windows-2022, macos-12, ubuntu-22.04]
|
||||
bits: [64, 32]
|
||||
godot_version: ["v3.4.5-stable", "v3.5-stable"]
|
||||
exclude:
|
||||
- os: macos-12
|
||||
bits: 32
|
||||
|
@ -267,10 +267,9 @@ jobs:
|
|||
timeout_minutes: 5
|
||||
max_attempts: 6
|
||||
|
||||
|
||||
# Git archive should only include addons/godot_xterm directory.
|
||||
check-archive:
|
||||
name: 'Check Archive'
|
||||
name: "Check Archive"
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
@ -304,7 +303,7 @@ jobs:
|
|||
fi
|
||||
|
||||
check-code-format:
|
||||
name: 'Check Code Format'
|
||||
name: "Check Code Format"
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
|
15
.pre-commit-config.yaml
Normal file
15
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
# SPDX-FileCopyrightText: none
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
ci:
|
||||
autofix_commit_msg: "fix: auto fixes"
|
||||
autoupdate_commit_msg: "chore: autoupdate"
|
||||
exclude: "^addons/gut/"
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v3.1.0
|
||||
hooks:
|
||||
- id: prettier
|
|
@ -1,27 +1,32 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [Unreleased](https://github.com/lihop/godot-xterm/compare/v2.2.0...HEAD)
|
||||
|
||||
### Changed
|
||||
|
||||
- Custom export templates are no longer required when exporting to HTML5 from Godot v3.5.x.
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed support for deprecated theme item names.
|
||||
- Removed deprecated get_master() method of PTY.
|
||||
- Removed deprecated cols/rows properties of Terminal.
|
||||
|
||||
|
||||
## [v2.2.0](https://github.com/lihop/godot-xterm/compare/v2.1.1...v2.2.0) - 2022-08-26
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed theme item names to be compatible with Godot version 3.5 (no spaces),
|
||||
consistent with other theme item names (snake_case), and to match the ANSI
|
||||
color names listed on the [ANSI escape code Wikipedia page](https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit).
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Deprecated the `cols` and `rows` properties of Terminal.
|
||||
These properties will be removed in a future version.
|
||||
Please use `get_cols()` and `get_rows()` instead.
|
||||
|
@ -58,21 +63,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- `Bold Italic` -> `bold_italic`
|
||||
|
||||
### Removed
|
||||
- Removed support for Godot version 3.3.x. GodotXterm *might* still work with this
|
||||
|
||||
- Removed support for Godot version 3.3.x. GodotXterm _might_ still work with this
|
||||
version of Godot if compiled with the correct version of godot-cpp, but compatibility
|
||||
is no longer officially supported.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#57][i57]: Screen is no longer erased on resize when using a custom theme.
|
||||
- [#58][i58]: Screen is no longer erased when changing themes.
|
||||
|
||||
[i57]: https://github.com/lihop/godot-xterm/issues/57
|
||||
[i58]: https://github.com/lihop/godot-xterm/issues/58
|
||||
|
||||
|
||||
## [v2.1.1](https://github.com/lihop/godot-xterm/compare/v2.1.0...v2.1.1) - 2022-08-15
|
||||
|
||||
### Fixed
|
||||
|
||||
Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing feedback on these issues:
|
||||
|
||||
- [#51][i51]: Fixed issue where terminal would lose focus on Tab/Arrow key presses
|
||||
when in a scene with other input nodes.
|
||||
- [#53][i53]: Fixed issue where terminal was not updating when there was no GUI
|
||||
|
@ -85,14 +94,16 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
|
|||
[i55]: https://github.com/lihop/godot-xterm/issues/55
|
||||
[i56]: https://github.com/lihop/godot-xterm/issues/56
|
||||
|
||||
|
||||
## [v2.1.0](https://github.com/lihop/godot-xterm/compare/v2.0.0...v2.1.0) - 2022-07-11
|
||||
|
||||
### Added
|
||||
|
||||
- Support for macOS universal (x86_64/arm64) binaries. The macOS binary
|
||||
`libgodot-xterm.osx.64.dylib` is now a universal binary that runs natively
|
||||
on both x86_64 and arm64.
|
||||
|
||||
### Changed
|
||||
|
||||
- Linux binaries now support systems with older GLIBC versions. By building the
|
||||
binaries inside a docker container with an older GLIBC version, the minimum
|
||||
required GLIBC version is now 2.17 which was released in 2012.
|
||||
|
@ -105,11 +116,13 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
|
|||
pressing modifier keys in isolation or when copying text using the shortcut Ctrl+Shift+C.
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed custom TerminalSettings Resource type.
|
||||
This Resource was not being used but would still appear in every resource dropdown.
|
||||
(Related issue [godotengine/godot#24643](https://github.com/godotengine/godot/issues/24643)).
|
||||
|
||||
### Fixed
|
||||
|
||||
- The `kill()` method of unix PTY node can now be called without error as the underlying
|
||||
`pipe.close()` method of the gdnative library is now registered.
|
||||
- Fixed 'Condition "!obj" is true.' error that would often print to console when
|
||||
|
@ -120,9 +133,10 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
|
|||
sometimes occur when closing a Terminal after calling `write()` but before VisualServer
|
||||
had finished drawing the current frame.
|
||||
|
||||
|
||||
## [v2.0.0](https://github.com/lihop/godot-xterm/compare/v1.2.1...v2.0.0) - 2021-07-25
|
||||
|
||||
### Added
|
||||
|
||||
- Terminal editor plugin. Adds integrated terminal to Godot editor.
|
||||
- Xresources import plugin.
|
||||
- [#39][i39]: Support for the bell "\u0007" character.
|
||||
|
@ -130,6 +144,7 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
|
|||
- [#24][i24]: Support for Windows 32-bit (Terminal node only).
|
||||
|
||||
### Changed
|
||||
|
||||
- [#44][i44]: Default theme to match Godot's default theme.
|
||||
- Supported Godot version -> 3.3.2.
|
||||
- Set a default theme if no theme property has been set.
|
||||
|
@ -137,6 +152,7 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
|
|||
- TPut no longer registered as a unique global class (i.e. removed `class_name TPut`).
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#40][i40]: Vim related bugs, caused by incorrectly handled control sequences.
|
||||
- Don't swap red and blue channels of theme colors.
|
||||
- Use "Light Cyan" color from theme. Previously ignored.
|
||||
|
@ -146,37 +162,44 @@ Thanks to [@ConteZero](https://github.com/contezero) for reporting and providing
|
|||
[i40]: https://github.com/lihop/godot-xterm/issues/40
|
||||
[i44]: https://github.com/lihop/godot-xterm/issues/44
|
||||
|
||||
|
||||
## [v1.2.1](https://github.com/lihop/godot-xterm/compare/v1.2.0...v1.2.1) - 2020-11-23
|
||||
|
||||
### Changed
|
||||
|
||||
- GitHub Actions workflow now produces both a release and debug zip archive.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Release binary for Windows 64-bit export.
|
||||
|
||||
|
||||
## [v1.2.0](https://github.com/lihop/godot-xterm/compare/v1.0.0...v1.2.0) - 2020-11-21
|
||||
|
||||
### Added
|
||||
|
||||
- Support for macOS 64-bit including Pseudoterminal.
|
||||
- Partial support for Windows 64-bit and compiling on Windows using MSVC. Pseudoterminal not yet supported. 32-bit builds might be possible but not yet built/tested.
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated build script. On Linux `./build.sh` will create a debug build of the gdnative library for the current platform.
|
||||
- Removed all pre-compiled binaries using BFG [Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/), thus re-writing git history.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed bug where incorrect data would sometimes be written to the terminal when passing a string to the Terminal's `write()` method.
|
||||
- Positioned background rect at 0,0 so it is no longer offset if a margin is added when Terminal is a child of a Container node.
|
||||
- Passed correct argv to the execvp call of Pseudoterminal. Previously argv[0] was not set to the program's name which caused the Pseudoterminal node not to work on macOS with the zsh shell.
|
||||
|
||||
|
||||
## [v1.0.0](https://github.com/lihop/godot-xterm/releases/tag/v1.0.0) - 2020-10-05
|
||||
|
||||
### Added
|
||||
|
||||
- Changelog.
|
||||
- Asciicast importer plugin. Enables the import of .cast ([asciicast files v2](https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v2.md)) that can be made using the [asciinema](https://asciinema.org/) terminal session recorder. See the [asciicast scene](/examples/asciicast) for example usage.
|
||||
- Pre-built binary for x11 platform.
|
||||
|
||||
### Changed
|
||||
|
||||
- Implementation of Terminal node from GDScript to GDNative using [Aetf's patched version of libtsm](https://github.com/Aetf/libtsm).
|
||||
- Move input handling to the Terminal node itself, rather than handling it in a seperate Control node.
|
||||
- The Terminal `write()` method now accepts both String and PoolByteArray.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<img align="left" width="64" height="64" src="./media/icon.png">
|
||||
|
||||
# GodotXterm - Terminal Emulator
|
||||
|
||||
<br/>
|
||||
|
||||
[![Godot Version](https://img.shields.io/badge/Godot-3.4.x-blue.svg)](#supported-godot-versions)
|
||||
|
@ -25,6 +26,7 @@ https://user-images.githubusercontent.com/3696783/126894061-a69eb6ad-9979-4723-a
|
|||
[![View it on GitHub](./media/view_it_on_github_button.png)](https://github.com/lihop/godot-xterm)
|
||||
|
||||
#### Table of Contents
|
||||
|
||||
1. [Features](#features)
|
||||
2. [Screenshots](#screenshots)
|
||||
3. [Demos and Examples](#demos-and-examples)
|
||||
|
@ -36,13 +38,15 @@ https://user-images.githubusercontent.com/3696783/126894061-a69eb6ad-9979-4723-a
|
|||
## Features
|
||||
|
||||
- ### [Terminal](https://lihop.github.io/godot-xterm/api/terminal)
|
||||
|
||||
A Terminal emulator Control node.
|
||||
|
||||
Supports ANSI and (some) XTerm Control Sequences which can be used to do things such as clear the screen, move the cursor, change printed text color, ring a bell, and so on.
|
||||
For an exhaustive list of terminal control sequences (not all of which are supported by GodotXterm) see ["XTerm Control Sequences"](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html).
|
||||
|
||||
- ### [PTY](https://lihop.github.io/godot-xterm/api/pty)
|
||||
*Linux and macOS only.*
|
||||
|
||||
_Linux and macOS only._
|
||||
|
||||
Node for forking processes (e.g. bash, nodejs, python) with pseudoterminal file descriptors.
|
||||
Can be used with the Terminal node to get an actual shell.
|
||||
|
@ -51,12 +55,14 @@ https://user-images.githubusercontent.com/3696783/126894061-a69eb6ad-9979-4723-a
|
|||
See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
|
||||
|
||||
- ### Terminal Editor Plugin
|
||||
*Linux and macOS only.*
|
||||
|
||||
_Linux and macOS only._
|
||||
|
||||
Adds a panel to the Editor's bottom panel that can be used to spawn terminals in the editor.
|
||||
Similar to VSCode's integrated terminal and IntelliJ's embedded terminal.
|
||||
|
||||
- ### Asciicast Import Plugin
|
||||
|
||||
Adds support for importing asciinema v2 `.cast` files as animations that can be played by an AnimationPlayer that is a child of a Terminal node.
|
||||
Example `.cast` files can be downloaded from the [asciinema website](https://asciinema.org).
|
||||
|
||||
|
@ -68,9 +74,9 @@ https://user-images.githubusercontent.com/3696783/126894061-a69eb6ad-9979-4723-a
|
|||
## Screenshots
|
||||
|
||||
| | |
|
||||
|--------------------------------------|--------------------------------------|
|
||||
|![](./media/screenshot_editor.png) |![](./media/screenshot_the_guest.png) |
|
||||
|![](./media/screenshot_retro_term.jpg)|![](./media/screenshot_xterminate.png)|
|
||||
| -------------------------------------- | -------------------------------------- |
|
||||
| ![](./media/screenshot_editor.png) | ![](./media/screenshot_the_guest.png) |
|
||||
| ![](./media/screenshot_retro_term.jpg) | ![](./media/screenshot_xterminate.png) |
|
||||
|
||||
## Demos and Examples
|
||||
|
||||
|
@ -93,7 +99,7 @@ Are you using GodotXterm in your project and want it listed here? Please [open a
|
|||
GodotXterm aims to support the current stable release of Godot, but may lag slightly.
|
||||
Currently, Godot versions 3.5.x and 3.4.x are supported, but custom export templates
|
||||
are required for HTML5 exports from versions < 3.5.
|
||||
Versions 3.3.x are no longer officially supported but *may* work if the GDNative libraries are
|
||||
Versions 3.3.x are no longer officially supported but _may_ work if the GDNative libraries are
|
||||
compiled using an older version of godot-cpp.
|
||||
|
||||
## Installation
|
||||
|
@ -122,10 +128,9 @@ The GDNative source code incorporates code snippets and source code from many th
|
|||
|
||||
- The Hack regular font is bundled with GodotXterm as the default Terminal font. This is also the default monospace font of the Godot editor. See the [full license](https://github.com/lihop/godot-xterm/blob/stable/addons/godot_xterm/themes/fonts/hack/LICENSE.md).
|
||||
|
||||
|
||||
### Nonbundled Resources
|
||||
The following resources are not bundled with GodotXterm (i.e. are not included in the `addons/godot_xterm` directory) but are included in this repository for demo and testing purposes. They are:
|
||||
|
||||
The following resources are not bundled with GodotXterm (i.e. are not included in the `addons/godot_xterm` directory) but are included in this repository for demo and testing purposes. They are:
|
||||
|
||||
#### Sounds
|
||||
|
||||
|
@ -133,7 +138,7 @@ The following resources are not bundled with GodotXterm (i.e. are not included i
|
|||
|
||||
#### Fonts
|
||||
|
||||
- The **bold**, *italic*, and ***bold italic*** styles of the Hack font which are covered by the same license as above.
|
||||
- The **bold**, _italic_, and **_bold italic_** styles of the Hack font which are covered by the same license as above.
|
||||
- Nerd Fonts. Combines symbols from a multitude of other fonts. See [license information](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/nerd_fonts/README.md).
|
||||
- Noto Color Emoji. Released under the [SIL Open Font License](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/noto_color_emoji/LICENSE_OFL.txt).
|
||||
- Unifont. Dual-licensed (since version 13.0.04) under the GNU GPL 2+ with the GNU font embedding exception and the SIL Open Font License (OFL) version 1.1. This project uses it under the terms of the [SIL Open Font License](https://github.com/lihop/godot-xterm/blob/stable/themes/fonts/unifont/LICENSE_OFL-1.1.txt).
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
#video-preview { display: none; }
|
||||
#video-preview {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ permalink: /api/pty
|
|||
|
||||
**Inherits:** [Node] < [Object]
|
||||
|
||||
*Linux and macOS only.*
|
||||
_Linux and macOS only._
|
||||
|
||||
Node for forking processes (e.g. bash, nodejs, python) with pseudoterminal file descriptors.
|
||||
Can be used with the [Terminal] node to get an actual shell.
|
||||
|
@ -18,28 +18,25 @@ Can be used with the [Terminal] node to get an actual shell.
|
|||
Not currently supported on Windows, but it could be in the future using [ConPTY](https://docs.microsoft.com/en-us/windows/console) or [WinPTY](https://github.com/rprichard/winpty).
|
||||
See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
|
||||
|
||||
|
||||
## Overview
|
||||
|
||||
![PTY Diagram](../media/pty_diagram.png)
|
||||
<sub>"PTY Diagram" is a derivative of [Termios-script-diagram.svg](https://commons.wikimedia.org/wiki/File:Termios-script-diagram.svg) by [Krishnavedala](https://en.wikipedia.org/wiki/User:Krishnavedala?rdfrom=commons:User:Krishnavedala), used under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/).
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Type | Name | Default |
|
||||
|--------------|--------------------------------------|--------------------------------------------------------|
|
||||
| ------------ | ------------------------------------ | ------------------------------------------------------ |
|
||||
| [NodePath] | [terminal_path](#prop-terminal_path) | None |
|
||||
| [int] | [cols](#prop-cols) | `80` |
|
||||
| [int] | [rows](#prop-rows) | `24` |
|
||||
| [Dictionary] | [env](#prop-env) | `{ COLORTERM = "truecolor", TERM = "xterm-256color" }` |
|
||||
| [bool] | [use_os_env](#prop-use_os_env) | `true` |
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
| Returns | Signature |
|
||||
|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [Error] | [fork](#mthd-fork) **(** [String] file=`$SHELL`, [PoolStringArray] args=[], [String] cwd=`$PWD`, [int] cols=80, [int] rows=24 **)** |
|
||||
| void | [kill](#mthd-kill) **(** [int] signum **)** |
|
||||
| [Error] | [open](#mthd-open) **(** [int] cols=80, [int] rows=24 **)** |
|
||||
|
@ -47,7 +44,6 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
|
|||
| void | [resizev](#mthd-resizev) **(** [Vector2] size **)** |
|
||||
| void | [write](#mthd-write) **(** [String]\|[PoolByteArray] data **)** |
|
||||
|
||||
|
||||
## Signals
|
||||
|
||||
- <a name="sgnl-data_received" /> **data_received** **(** [PoolByteArray] data **)**
|
||||
|
@ -77,28 +73,27 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
|
|||
- **SIGALRM** = 14 --- Alarm clock.
|
||||
- **SIGTERM** = 15 --- Termination signal.
|
||||
|
||||
|
||||
## Property Descriptions
|
||||
|
||||
### <a name="prop-terminal_path" /> [NodePath] **terminal_path**
|
||||
|
||||
| | |
|
||||
|-----------|--------------------------|
|
||||
| *Default* | None |
|
||||
| *Setter* | set_terminal_path(value) |
|
||||
| *Getter* | None |
|
||||
| | |
|
||||
| --------- | ------------------------ |
|
||||
| _Default_ | None |
|
||||
| _Setter_ | set_terminal_path(value) |
|
||||
| _Getter_ | None |
|
||||
|
||||
[NodePath] to a [Terminal]. Setting this path will automatically connect the appropriate signals of both nodes for standard operation. It will also disconnected the signals of the previously set terminal, if any.
|
||||
[NodePath] to a [Terminal]. Setting this path will automatically connect the appropriate signals of both nodes for standard operation. It will also disconnected the signals of the previously set terminal, if any.
|
||||
|
||||
---
|
||||
|
||||
- <a name="prop-cols" /> [int] **cols**
|
||||
|
||||
| | |
|
||||
|-----------|--------------------------|
|
||||
| *Default* | `80` |
|
||||
| *Setter* | set_cols(value) |
|
||||
| *Getter* | None |
|
||||
| --------- | --------------- |
|
||||
| _Default_ | `80` |
|
||||
| _Setter_ | set_cols(value) |
|
||||
| _Getter_ | None |
|
||||
|
||||
The column size in characters.
|
||||
|
||||
|
@ -107,10 +102,10 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
|
|||
- <a name="prop-rows" /> [int] **rows**
|
||||
|
||||
| | |
|
||||
|-----------|--------------------------|
|
||||
| *Default* | `24` |
|
||||
| *Setter* | set_rows(value) |
|
||||
| *Getter* | None |
|
||||
| --------- | --------------- |
|
||||
| _Default_ | `24` |
|
||||
| _Setter_ | set_rows(value) |
|
||||
| _Getter_ | None |
|
||||
|
||||
The row size in characters.
|
||||
|
||||
|
@ -119,10 +114,10 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
|
|||
- <a name="prop-env" /> [Dictionary] **env**
|
||||
|
||||
| | |
|
||||
|-----------|--------------------------------------------------------|
|
||||
| *Default* | `{ COLORTERM = "truecolor", TERM = "xterm-256color" }` |
|
||||
| *Setter* | None |
|
||||
| *Getter* | None |
|
||||
| --------- | ------------------------------------------------------ |
|
||||
| _Default_ | `{ COLORTERM = "truecolor", TERM = "xterm-256color" }` |
|
||||
| _Setter_ | None |
|
||||
| _Getter_ | None |
|
||||
|
||||
Environment variables to be set for the child program.
|
||||
|
||||
|
@ -131,14 +126,13 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
|
|||
- <a name="prop-use_os_env" /> [bool] **use_os_env**
|
||||
|
||||
| | |
|
||||
|-----------|--------|
|
||||
| *Default* | `true` |
|
||||
| *Setter* | None |
|
||||
| *Getter* | None |
|
||||
| --------- | ------ |
|
||||
| _Default_ | `true` |
|
||||
| _Setter_ | None |
|
||||
| _Getter_ | None |
|
||||
|
||||
If `true` the environment variables from `env` will be merged with the environment variables of the current program (i.e. Godot), with the variables from `env` taking precedence over the environment variables of the current program.
|
||||
|
||||
|
||||
## Method Descriptions
|
||||
|
||||
- <a name="mthd-fork" /> [Error] **fork** **(** [String] file=`$SHELL`, [PoolStringArray] args=[], [String] cwd=`$PWD`, [int] cols=80, [int] rows=24 **)**
|
||||
|
@ -184,7 +178,6 @@ See issue [\#25](https://github.com/lihop/godot-xterm/issues/25).
|
|||
|
||||
Writes data to the pseudoterminal master device.
|
||||
|
||||
|
||||
[Dictionary]: https://docs.godotengine.org/en/stable/classes/class_dictionary.html
|
||||
[Error]: https://docs.godotengine.org/en/stable/classes/class_%40globalscope.html#enum-globalscope-error
|
||||
[Node]: https://docs.godotengine.org/en/stable/classes/class_node.html
|
||||
|
|
|
@ -15,8 +15,8 @@ A Terminal emulator Control node.
|
|||
Supports ANSI and (some) XTerm Control Sequences which can be used to do things such as clear the screen, move the cursor, change printed text color, ring a bell, and so on.
|
||||
For an exhaustive list of terminal control sequences (not all of which are supported by GodotXterm) see ["XTerm Control Sequences"](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html).
|
||||
|
||||
|
||||
## Overview
|
||||
|
||||
![Terminal Flow Diagram](../media/flow_diagram.svg)
|
||||
<sub>"Terminal Flow Diagram" is a derivative of ["computer keyboard 2"](https://openclipart.org/detail/2396/computer-keyboard-2) and ["monitor"](https://openclipart.org/detail/1637/monitor), from U.S. patent drawings, uploaded by [johnny_automatic](https://openclipart.org/artist/johnny_automatic), used under [CC0](https://creativecommons.org/share-your-work/public-domain/cc0/).<sub/>
|
||||
|
||||
|
@ -40,20 +40,18 @@ In the other direction, data can be sent to the terminal. This corresponds to th
|
|||
The input from (3) is then interpreted by the terminal state machine and drawn to the screen.
|
||||
For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal, then it would draw a green colored capital letter 'A' on the screen.
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
| Type | Name | Default |
|
||||
|--------------|--------------------------------------|---------|
|
||||
| ------------ | ------------------------------------ | ------- |
|
||||
| [bool] | [bell_muted](#prop-bell_muted) | `false` |
|
||||
| [float] | [bell_cooldown](#prop-bell_cooldown) | `0.1` |
|
||||
| [UpdateMode] | [update_mode](#prop-update_mode) | `AUTO` |
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
| Returns | Signature |
|
||||
|----------|-------------------------------------------------------------------|
|
||||
| -------- | ----------------------------------------------------------------- |
|
||||
| void | [clear](#mthd-clear) **()** |
|
||||
| [String] | [copy_all](#mthd-copy_all) **()** |
|
||||
| [String] | [copy_selection](#mthd-copy_selection) **()** |
|
||||
|
@ -61,7 +59,6 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
|
|||
| [int] | [get_rows](#mthd-get_rows) **()** |
|
||||
| void | [write](#mthd-write) **(** [String] \| [PoolByteArray] data **)** |
|
||||
|
||||
|
||||
## Signals
|
||||
|
||||
- <a name="sgnl-bell" /> **bell** **()**
|
||||
|
@ -92,7 +89,6 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
|
|||
`new_size.x` will be the number of columns and `new_size.y` will be the number of rows.
|
||||
This information should be forwarded to a pseudoterminal, if it is connected, so that it can update its size accordingly.
|
||||
|
||||
|
||||
## Enumerations
|
||||
|
||||
<a name="enum-update_mode" /> enum **UpdateMode**:
|
||||
|
@ -102,17 +98,15 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
|
|||
- **ALL** = **2** --- Every cell will be drawn on every `update()` call.
|
||||
- **ALL_NEXT_FRAME** = **3** --- Draws every cell afetr the next `update()` call, then returns to **AUTO**.
|
||||
|
||||
|
||||
## Property Descriptions
|
||||
|
||||
|
||||
- <a name="prop-bell_muted" /> [bool] **bell_muted**
|
||||
|
||||
| | |
|
||||
|-----------|---------|
|
||||
| *Default* | `false` |
|
||||
| *Setter* | None |
|
||||
| *Getter* | None |
|
||||
| --------- | ------- |
|
||||
| _Default_ | `false` |
|
||||
| _Setter_ | None |
|
||||
| _Getter_ | None |
|
||||
|
||||
If muted, no [`bell`](#sgnl-bell) signal will be emitted when the bell character (`"\u0007"`) is written to the terminal.
|
||||
|
||||
|
@ -121,10 +115,10 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
|
|||
- <a name="prop-bell_cooldown" /> [float] **bell_cooldown**
|
||||
|
||||
| | |
|
||||
|-----------|-------|
|
||||
| *Default* | `0.1` |
|
||||
| *Setter* | None |
|
||||
| *Getter* | None |
|
||||
| --------- | ----- |
|
||||
| _Default_ | `0.1` |
|
||||
| _Setter_ | None |
|
||||
| _Getter_ | None |
|
||||
|
||||
The minimum amount of time to wait before emitting another [`bell`](#sgnl-bell) signal on subsequent writes of the bell character.
|
||||
Writing the bell character too frequently, for example by running the command `while true; do echo -e "\a"; done`,
|
||||
|
@ -136,17 +130,16 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
|
|||
- <a name="prop-update_mode" /> [UpdateMode] **update_mode**
|
||||
|
||||
| | |
|
||||
|-----------|------------------------|
|
||||
| *Default* | `AUTO` |
|
||||
| *Setter* | set_update_mode(value) |
|
||||
| *Getter* | None |
|
||||
| --------- | ---------------------- |
|
||||
| _Default_ | `AUTO` |
|
||||
| _Setter_ | set_update_mode(value) |
|
||||
| _Getter_ | None |
|
||||
|
||||
Determines which cells of the terminal will be updated when its state changes.
|
||||
By default `AUTO` will only update cells that changed, but will update all cells (i.e. the entire screen) on major changes,
|
||||
such as terminal resize.
|
||||
If you are having trouble with the terminal not updating correctly or exhibiting artifacts, you can try remedying this by setting `update_mode` to `ALL`, however, this will have a negative impact on performance.
|
||||
|
||||
|
||||
## Method Descriptions
|
||||
|
||||
- <a name="mthd-clear" /> void **clear** **()**
|
||||
|
@ -190,6 +183,7 @@ For example if the string `"\u001b[38;2;0;255;0;mA"` was written to the terminal
|
|||
Typically it would be connected to the output of a [PTY]'s [`data_received()`](/api/pty#sgnl-data_received) signal.
|
||||
|
||||
Example:
|
||||
|
||||
```gdscript
|
||||
$Terminal.write("Hello World")
|
||||
$Terminal.write("Hello World".to_utf8())
|
||||
|
|
|
@ -27,10 +27,12 @@ This plugin follows the same format as the [GDNative C++ Example](https://docs.g
|
|||
## The Easy Way
|
||||
|
||||
Run the build script in `addons/godot-xterm/native`:
|
||||
|
||||
```
|
||||
cd addons/godot_xterm/native
|
||||
./build.sh
|
||||
```
|
||||
|
||||
On Windows you can use `git-bash` to run this script.
|
||||
Provided the dependencies above are installed then it should "just work™".
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ permalink: /setup/precompiled-binaries
|
|||
---
|
||||
|
||||
# Precompiled Binaries
|
||||
|
||||
{: .no_toc }
|
||||
|
||||
Installing GodotXterm using precompiled binaries means that you wont be required
|
||||
|
@ -15,7 +16,7 @@ of copying files to the correct location in your project. These files can be
|
|||
installed from several sources:
|
||||
|
||||
1. TOC
|
||||
{:toc}
|
||||
{:toc}
|
||||
|
||||
**Note:** precompiled binaries will only work with certain versions of Godot
|
||||
(usually the current stable release). If you need binaries for a different or
|
||||
|
@ -23,26 +24,33 @@ custom Godot version, or want to make modifications to the C/C++ code, please
|
|||
refer to the section on [Building From Source](/setup/building-from-source).
|
||||
|
||||
## Godot Asset Library
|
||||
|
||||
GodotXterm can be installed from the [Godot Asset Library](https://godotengine.org/asset-library/asset/1007).
|
||||
See the [Godot Asset Library documentation](https://docs.godotengine.org/en/stable/community/asset_library/using_assetlib.html) for more info on how to use it.
|
||||
|
||||
## Gd-plug Plugin Manager
|
||||
|
||||
If you are using the gd-plug plugin manager you can add the following line to your `plug.gd` file:
|
||||
|
||||
```
|
||||
plug("lihop/godot-xterm-dist", {commit = "a1131a562e8e8f0c57b0ddf61de7fa015d463ba0", include = ["addons/godot_xterm"]})
|
||||
```
|
||||
|
||||
Replace the commit hash with the hash of the GodotXterm version you wish to install.
|
||||
See [tags](https://github.com/lihop/godot-xterm-dist/tags) for a list of versions and their corresponding commit hashes.
|
||||
See the [gd-plug documentation](https://github.com/imjp94/gd-plug/blob/master/README.md) for more info on how to use it.
|
||||
|
||||
## Manual Installation
|
||||
|
||||
Alternatively, GodotXterm can be installed manually in two steps:
|
||||
|
||||
1. Copy the [`addons/godot_xterm`](https://github.com/lihop/godot-xterm/tree/stable/addons/godot_xterm) directory to the `addons` directory of your Godot project.
|
||||
2. Copy the GDNative binaries into `addons/godot_xterm/native/bin` directory.
|
||||
|
||||
The easiest way to obtain the GDNative binaries is to download them from [the Releases page](https://github.com/lihop/godot-xterm/releases).
|
||||
Download the zip archive named `libgodot-xterm-release.zip` and extract its contents into the `/addons/godot_xterm/native/bin` directory of your project.
|
||||
After this your `addons/godot_xterm/native/bin` directory should contain the following files:
|
||||
|
||||
- `libgodot-xterm.javascript.32.wasm`
|
||||
- `libgodot-xterm.linux.32.so`
|
||||
- `libgodot-xterm.linux.64.so`
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/run/current-system/sw/bin/godot",
|
||||
"args": [
|
||||
"${workspaceFolder}/examples/menu/menu.tscn",
|
||||
],
|
||||
"args": ["${workspaceFolder}/examples/menu/menu.tscn"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
|
@ -21,14 +19,14 @@
|
|||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true,
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Set Disassembly Flavor to Intel",
|
||||
"text": "-gdb-set disassembly-flavor intel",
|
||||
"ignoreFailures": true,
|
||||
},
|
||||
],
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
|
@ -36,9 +34,7 @@
|
|||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/run/current-system/sw/bin/godot",
|
||||
"args": [
|
||||
"--editor",
|
||||
],
|
||||
"args": ["--editor"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
|
@ -48,29 +44,25 @@
|
|||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true,
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Set Disassembly Flavor to Intel",
|
||||
"text": "-gdb-set disassembly-flavor intel",
|
||||
"ignoreFailures": true,
|
||||
"ignoreFailures": true
|
||||
},
|
||||
{
|
||||
"description": "Debug forked child process",
|
||||
"text": "-gdb-set follow-fork-mode child",
|
||||
},
|
||||
],
|
||||
"text": "-gdb-set follow-fork-mode child"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Test (gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "/run/current-system/sw/bin/godot",
|
||||
"args": [
|
||||
"--no-window",
|
||||
"-s",
|
||||
"addons/gut/gut_cmdln.gd"
|
||||
],
|
||||
"args": ["--no-window", "-s", "addons/gut/gut_cmdln.gd"],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
|
@ -80,9 +72,9 @@
|
|||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -7,17 +7,10 @@
|
|||
"label": "build",
|
||||
"type": "shell",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/addons/godot_xterm/native",
|
||||
"cwd": "${workspaceFolder}/addons/godot_xterm/native"
|
||||
},
|
||||
"command": "nix-shell",
|
||||
"args": [
|
||||
"-I",
|
||||
"nixpkgs=~/nixpkgs",
|
||||
"-p",
|
||||
"scons",
|
||||
"--run",
|
||||
"./build.sh"
|
||||
],
|
||||
"args": ["-I", "nixpkgs=~/nixpkgs", "-p", "scons", "--run", "./build.sh"],
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
{
|
||||
"dirs": [
|
||||
"res://test/unit",
|
||||
"res://test/integration"
|
||||
],
|
||||
"dirs": ["res://test/unit", "res://test/integration"],
|
||||
"prefix": "",
|
||||
"suffix": ".test.gd",
|
||||
"include_subdirs": true,
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{
|
||||
"dirs": [
|
||||
"res://test/platform/unix"
|
||||
],
|
||||
"dirs": ["res://test/platform/unix"],
|
||||
"prefix": "",
|
||||
"suffix": ".test.gd",
|
||||
"include_subdirs": true,
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
"dirs": [
|
||||
"res://platform/windows"
|
||||
],
|
||||
"dirs": ["res://platform/windows"],
|
||||
"prefix": "",
|
||||
"suffix": ".test.gd",
|
||||
"include_subdirs": true,
|
||||
"log_level": 2,
|
||||
"should_exit": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { defineConfig } = require("cypress");
|
||||
const getCompareSnapshotsPlugin = require('cypress-image-diff-js/dist/plugin');
|
||||
const getCompareSnapshotsPlugin = require("cypress-image-diff-js/dist/plugin");
|
||||
|
||||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
Cypress.on('window:before:load', win => {
|
||||
cy.spy(win.console, 'error')
|
||||
cy.spy(win.console, 'warn')
|
||||
cy.spy(win.console, 'log')
|
||||
})
|
||||
Cypress.on("window:before:load", (win) => {
|
||||
cy.spy(win.console, "error");
|
||||
cy.spy(win.console, "warn");
|
||||
cy.spy(win.console, "log");
|
||||
});
|
||||
|
||||
describe('GodotXterm HTML5 export', () => {
|
||||
it('Loads and runs without error', () => {
|
||||
cy.visit('http://localhost:3000')
|
||||
cy.compareSnapshot('menu', 0.9, {
|
||||
limit: 100, delay: 200, timeout: 20000,
|
||||
})
|
||||
cy.get('body').type('{downArrow}{enter}')
|
||||
cy.get('body').type('window.console.log("It works!"){enter}')
|
||||
cy.window().then(win => {
|
||||
cy.expect(win.console.error).to.have.callCount(0)
|
||||
cy.expect(win.console.warn).to.have.callCount(0)
|
||||
cy.expect(win.console.log).to.be.calledWith("It works!")
|
||||
})
|
||||
})
|
||||
})
|
||||
describe("GodotXterm HTML5 export", () => {
|
||||
it("Loads and runs without error", () => {
|
||||
cy.visit("http://localhost:3000");
|
||||
cy.compareSnapshot("menu", 0.9, {
|
||||
limit: 100,
|
||||
delay: 200,
|
||||
timeout: 20000,
|
||||
});
|
||||
cy.get("body").type("{downArrow}{enter}");
|
||||
cy.get("body").type('window.console.log("It works!"){enter}');
|
||||
cy.window().then((win) => {
|
||||
cy.expect(win.console.error).to.have.callCount(0);
|
||||
cy.expect(win.console.warn).to.have.callCount(0);
|
||||
cy.expect(win.console.log).to.be.calledWith("It works!");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
import compareSnapshotCommand from 'cypress-image-diff-js/dist/command';
|
||||
import compareSnapshotCommand from "cypress-image-diff-js/dist/command";
|
||||
compareSnapshotCommand();
|
||||
|
|
|
@ -1 +1 @@
|
|||
import './commands'
|
||||
import "./commands";
|
||||
|
|
Loading…
Reference in a new issue