Add more features, bug fixes and bugs ;-)

Most notably:
- Reflow is now working. Terminal size will fill the window and
cols/rows will be resized/calculated based on window and font size.
- Added support for different fonts (i.e. bold, italic, bolditalic).
- Enabled blinking characters.
- Adde more tests and caught a few subtle bugs.
- Removed renderer code (which was part of xterm.js) and just
doing naive rendering in terminal.gd, but it seems to perform
a lot faster.

Still not working completely:
- vim (some weirdness going on).
- vttest (more weirdness).

Todo:
- Fix the above.
- Draw the cursor!
- Improve performance. Performance is still not great. The terminal
becomes unusable when running `yes` or `cmatrix -r`.
This commit is contained in:
Leroy Hopson 2020-05-19 18:45:18 +07:00
parent 0769592a1b
commit 0d4e10f5ab
30 changed files with 2640 additions and 1157 deletions

View file

@ -38,7 +38,6 @@ func _ready():
if err != OK:
OS.alert("Couldn't connect to socat on %s:%d" % [host, port], "Connection Failed!")
var status = stream_peer.get_status()
var connected = stream_peer.is_connected_to_host()
@ -51,6 +50,13 @@ func _ready():
# Connect the Terminal and StreamPeer.
$Terminal.connect('output', self, 'send_data')
connect("data_received", $Terminal, "write")
connect("resized", self, "_resize_terminal")
_resize_terminal()
func _resize_terminal():
$Terminal.rect_size = OS.window_size
func send_data(data: PoolByteArray):

View file

@ -8,6 +8,7 @@
[ext_resource path="res://addons/godot_xterm/fonts/source_code_pro/source_code_pro_bold.tres" type="DynamicFont" id=6]
[node name="Demo" type="Control"]
show_behind_parent = true
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
@ -16,25 +17,39 @@ __meta__ = {
}
[node name="Terminal" type="Control" parent="."]
margin_left = 95.937
margin_top = 44.6138
margin_right = 695.937
margin_bottom = 444.614
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 600, 400 )
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
auto_resize = true
font_family = {
"bold": ExtResource( 6 ),
"bold_italic": ExtResource( 5 ),
"italic": ExtResource( 4 ),
"regular": ExtResource( 3 )
}
font_size = 16
line_height = 1.15
colors = {
"black": Color( 0.121569, 0.00784314, 0.00784314, 1 )
"black": Color( 0.180392, 0.203922, 0.211765, 1 ),
"blue": Color( 0.203922, 0.396078, 0.643137, 1 ),
"bright_black": Color( 0.333333, 0.341176, 0.32549, 1 ),
"bright_blue": Color( 0.447059, 0.623529, 0.811765, 1 ),
"bright_cyan": Color( 0.203922, 0.886275, 0.886275, 1 ),
"bright_green": Color( 0.541176, 0.886275, 0.203922, 1 ),
"bright_magenta": Color( 0.678431, 0.498039, 0.658824, 1 ),
"bright_red": Color( 0.937255, 0.160784, 0.160784, 1 ),
"bright_white": Color( 0.933333, 0.933333, 0.92549, 1 ),
"bright_yellow": Color( 0.988235, 0.913725, 0.309804, 1 ),
"cyan": Color( 0.0235294, 0.596078, 0.603922, 1 ),
"green": Color( 0.305882, 0.603922, 0.0235294, 1 ),
"magenta": Color( 0.458824, 0.313726, 0.482353, 1 ),
"red": Color( 0.8, 0, 0, 1 ),
"white": Color( 0.827451, 0.843137, 0.811765, 1 ),
"yellow": Color( 0.768627, 0.627451, 0, 1 )
}
window_options = {
"set_win_lines": false
}