lihop / godot-xterm Goto Github PK
View Code? Open in Web Editor NEWTerminal emulator for the Godot game engine.
License: MIT License
Terminal emulator for the Godot game engine.
License: MIT License
With the upgrade of libtsm in d2f073d, we now have a callback for the bell character (ascii 07). This means we can emit a bell_rang
signal when the bell character is "rung" which could then be connected to an AudioStreamPlayer node.
The GitHub actions workflow (.github/workflows/main.yml) needs to be upgraded to work with Godot 4. This will require the addition of Godot 4 support to the lihop/setup-godot GitHub action (lihop/godot-setup#7).
Tests will also need to be fixed (#66) for the full CI/CD pipeline to pass.
Is the Godot 4 branch supposed to be working? I'm interested in getting this to work specifically for Windows.
We can get mouse button events from Godot and send them to the terminal using the appropriate control sequences.
See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking.
UpdateMode.AUTO usually only draws changed cells, but is supposed to redraw the entire screen when the Terminal's parent viewport is cleared (i.e. on resize). But it doesn't always work.
Setting update_mode to UpdateMode.ALL (which redraws the entire screen on every update) does not have this problem, but is bad for performance (more than doubling or tripling the frame time).
It would be nice to be able to set the alpha for terminal theme colors and have the terminal drawn with transparency.
I'm using the Terminal node in a scene together with some LineEdit nodes.
When the focus is on the terminal, focus will switch to other LineEdit nodes after pressing some keys (KEY_UP, KEY_DOWN, KEY_TAB).
In terminal.gd
I've changed:
func _gui_input(event):
_native_terminal._gui_input(event)
if event is InputEventKey and event.pressed:
# Return to bottom of scrollback buffer if we scrolled up. Ignore modifier
# keys pressed in isolation or if Ctrl+Shift modifier keys are pressed.
if (
not event.scancode in [KEY_ALT, KEY_SHIFT, KEY_CONTROL, KEY_META, KEY_MASK_CMD]
and not (event.control and event.shift)
):
_native_terminal.sb_reset()
_handle_mouse_wheel(event)
_handle_selection(event)
with this:
func _input(event):
if has_focus():
_native_terminal._gui_input(event)
if event is InputEventKey and event.pressed:
# Return to bottom of scrollback buffer if we scrolled up. Ignore modifier
# keys pressed in isolation or if Ctrl+Shift modifier keys are pressed.
if (
not event.scancode in [KEY_ALT, KEY_SHIFT, KEY_CONTROL, KEY_META, KEY_MASK_CMD]
and not (event.control and event.shift)
):
_native_terminal.sb_reset()
if event.scancode in [KEY_DOWN, KEY_UP, KEY_TAB]:
get_tree().set_input_as_handled()
_handle_mouse_wheel(event)
_handle_selection(event)
This code solves the focus switch problem, but it is not the right fix because from my tests sometimes it causes some key press to be lost.
Steps to reproduce:
extends Control
func _process(delta):
var string = "\u001b[0m\u001b[?7h\u001b[0ma\u001b[0m\r\r\n\u001b[0m"
$Terminal.write(string)
Expected: A repeating column of the letter 'a' along the left side of the terminal.
Actual: Unexpected characters.
Resizing the terminal a few times results in a "Unicode error: invalid skip" error.
Default shortcuts:
Ctrl+Shift+C
Ctrl+Shift+P
Ctrl+Shift+X
Ctrl+Shift+T
Ctrl+Shift+PgUp
Ctrl+Shift+PgDown
All of these use the Shift
modifier as to not conflict with control character input. For example, Ctrl+C
is used to write the "end of text" control character.
These shortcuts should also be shown (in brackets) in the "right-click" popup menu:
As a bonus, these shortcuts should be configurable in editor settings (see #64). Shortcut settings are not currently exposed by the engine, but it looks like there are plans to expose them in the future. In the meantime, we could use string representations of the shortcuts and parse them using OS.find_keycode_from_string().
While executing some commands the following errors appear in the logs:
Unicode error: no space left
Unicode error: invalid skip
Some texts are not displayed in the terminal and sometimes strange behaviors appear on the screen.
test-2022-08-09.zip
I've uploaded a zipped mp4 file because github do not recognize it as valid mp4 file.
I've used Godot 3.5 and man scout
is not the only command that has this problem, in my system it happens with other commands too, here are some examples:
man -Len -Tutf8 virt-edit
man -Len -Tutf8 dialog
man -Len -Tutf8 systemd-xdg-autostart-generator
man -Len -Tutf8 firewall-cmd
Hi, wonderful people ๐
I plan to use Godot with F#, that is currently being worked on, to be supported.
Haxe, Lua, Javascript and a couple of other languages also work on Godot 4 compatibility.
I am one of the maintainers of that wonderful list, if you are interested about other language support.
So, do you help us, by letting us use your wonderful terminal as Script replacement?
People could start their own Helix/NeoVim or Emacs there, and develop at the same place, game and code. ๐ฅณ
Draw an outline around the editor terminal when it is focused.
Although this feature is currently lacking in GodotXterm, the bright blue border of Godot 4's default theme makes the lack of this feature more obvious.
Implementing #29 would also help indicate that the editor terminal is or isn't focused.
When using a custom theme (i.e. the 'theme' property of Terminal is not null), visible characters disappear after resizing the window.
Expected: Visible characters continue to be displayed, but in the colors of the new theme.
Actual: Visible characters disappear, but the cursor remains in the correct position.
Now that #17 is fixed, the full emojis are shown. But they make very poor use of available space.
For example:
Highlighted is the complete space (two cells) dedicated to this character however, there are at least 4 pixels on the right and top, 2 pixels on the left and 1pixel on the bottom that this emoji could be use.
I also encountered another problem, but I don't know if it can be related to this one.
With the same setup (scene with Terminal,Pty and other input nodes) if I execute a command with sudo
the terminal screen do not show the command output, to force a refresh I need to press a key or click on other input field to switch focus.
The same command executed without sudo
works as expected, the screen show the output.
ping www.google.com
works
sudo ping www.google.com
doesn't work
Originally posted by @ConteZero in #51 (comment)
When the terminal is enlarged blank space is added below the buffered row. However, when the terminal is shrunk, this blank space is not removed but rather the buffered rows starting at the top.
Compare this behavior with the behavior of xterm:
This can causes issues when the Terminal is placed inside a TabContainer as it is actually resized (enlarged by two rows and then shrunk back to the original size) when switching tabs, which results in the output being hidden:
GUT has been upgraded to a version that supports Godot 4, however many of the tests in /test are still broken.
When running the terminal example scene the initial PTY size does not match the Terminal size but rather the default of 24x80.
This results in some undesirable behaviour:
This is fixed after resizing the Terminal (for example, by resizing the application window) so it emits the size_changed()
signal, causing PTY to update to the correct size:
Currently the GitHub action workflow only builds 64-bit windows.
We should build 32-bit too.
So first I need the ability to read the current cursor position from the terminal.
A couple of ideas for how it could be done:
Both of those would be useful in different ways, but I think either one could do the job.
The other request is a way to read the current character attributes (SGR). That is, the fg/bg/bold/etc values that are in effect and will be used on the next write().
As above, this could be done by:
Of course, the implementation ideas above are just my uninformed thoughts. There's a lot I really don't understand about how this is implemented, so you might easily have a better approach.
Is this somehow supposed to become ported to Godot 4?
๐
Currently, the Pseudoterminal node is only supported on Linux and MacOS. Using winpty or conpty it should be possible to support this node on Windows also.
See https://github.com/microsoft/node-pty/tree/master/src/win for an example of how these libraries are used to open a pseudoterminal on windows.
Using EditorSettings we can create a new section in the editor settings modal ("Editor" -> "Editor Settings" -> "General") for configuration of the integrated terminal.
This will allow the user to set things such as font, font size, theme, bell settings, bell sound, etc. and re-use these settings across projects.
Some colors are barely legible. Especially the dark blue.
Making a color scheme similar to Godot's script editor could be a good idea, especially as a default theme for #43:
Although GodotXterm was originally created for use in-game, the pieces are almost in place such that it would be quite easy to add it as an editor plugin to the bottom panel.
Reasons to do this:
Related godot proposal which goes into more detail godotengine/godot-proposals#1379
Rudimentary terminal panel added by #48:
Features to add (using vscode terminal as a reference):
Things to fix:
Storing pre-compiled binaries in the master branches uses too much space.
A previously added debug binary takes up ~75M and release binaries are ~5M which will use a lot of space on subsequent releases and when support for more platforms is added.
Therefore, I will be removing existing binaries from the master branch using BFG Repo-Cleaner which will rewrite history.
Making pre-compiled binaries available is still useful however, so going forwards I will either add them to the GitHub release or create and tag a new anonymous branch which contains the binaries as detailed here: https://stackoverflow.com/questions/50974474/how-to-save-dist-build-files-on-github-release-but-not-in-master.
The asciicast file header has an optional theme field that could be used to generate a .theme file to be used by the terminal when playing the recording.
Hello, first let me say specialist thanks to you for this great plugin.
next, I have a question, please guide me.
why do not you create a vim plugin for the Godot editor? I mean things like the vim plugin for Atom.
is it difficult? if I want to start creating a vim plugin for Godot editor like the existing vim plugin for Atom, where can I start?
do you know it? could you help me?
P.S.
sorry, I'm not good in english.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.