From 5a291685fa5ce9da1509ad8f88e6d6e56e8b4f62 Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Sat, 5 Sep 2020 10:47:38 +0200 Subject: [PATCH] Improve fonts and colors --- fonts/big.tres | 7 +++++++ main.tscn | 2 ++ repository.tscn | 7 +++++-- terminal.gd | 20 ++++++++++---------- terminal.tscn | 30 +++++++++++++++++------------- 5 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 fonts/big.tres diff --git a/fonts/big.tres b/fonts/big.tres new file mode 100644 index 0000000..108575f --- /dev/null +++ b/fonts/big.tres @@ -0,0 +1,7 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://fonts/iosevka-regular.ttf" type="DynamicFontData" id=1] + +[resource] +size = 40 +font_data = ExtResource( 1 ) diff --git a/main.tscn b/main.tscn index 2f49825..2ca3837 100644 --- a/main.tscn +++ b/main.tscn @@ -32,6 +32,8 @@ margin_top = 484.0 margin_right = 1907.0 margin_bottom = 1068.0 custom_fonts/font = ExtResource( 5 ) +custom_colors/background_color = Color( 0, 0, 0, 1 ) +syntax_highlighting = true __meta__ = { "_edit_use_anchors_": false } diff --git a/repository.tscn b/repository.tscn index 830b593..cdc849d 100644 --- a/repository.tscn +++ b/repository.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://repository.gd" type="Script" id=1] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2] +[ext_resource path="res://fonts/big.tres" type="DynamicFont" id=3] [node name="Repository" type="Container"] anchor_right = 1.0 @@ -17,6 +18,7 @@ __meta__ = { } [node name="Index" type="Label" parent="."] +visible = false margin_left = 32.0 margin_top = 80.0 margin_right = 375.079 @@ -29,6 +31,7 @@ __meta__ = { } [node name="IndexLabel" type="Label" parent="."] +visible = false margin_left = 21.0 margin_top = 65.0 margin_right = 377.0 @@ -52,6 +55,6 @@ __meta__ = { [node name="Label" type="Label" parent="."] margin_left = 20.0 margin_top = 20.0 -custom_fonts/font = ExtResource( 2 ) +custom_fonts/font = ExtResource( 3 ) text = "Repo name" [connection signal="pressed" from="Button" to="." method="update_everything"] diff --git a/terminal.gd b/terminal.gd index 9041cde..04766dc 100644 --- a/terminal.gd +++ b/terminal.gd @@ -11,22 +11,22 @@ onready var output = $Control/Output func _input(event): if history.size() > 0: if event.is_action_pressed("ui_up"): - history_position -= 1 - history_position %= history.size() - input.text = history[history_position] - input.caret_position = input.text.length() + if history_position > 0: + history_position -= 1 + input.text = history[history_position] + input.caret_position = input.text.length() # This prevents the Input taking the arrow as a "skip to beginning" command. get_tree().set_input_as_handled() if event.is_action_pressed("ui_down"): - history_position += 1 - history_position %= history.size() - input.text = history[history_position] - input.caret_position = input.text.length() + if history_position < history.size()-1: + history_position += 1 + input.text = history[history_position] + input.caret_position = input.text.length() get_tree().set_input_as_handled() func send_command(command): history.push_back(command) - history_position += 1 + history_position = history.size() thread = Thread.new() thread.start(self, "run_command_in_a_thread", command) @@ -36,5 +36,5 @@ func run_command_in_a_thread(command): input.text = "" output.text = output.text + "$ " + command + "\n" + o - output.scroll_vertical = 999999 + #output.scroll_vertical = 999999 $"../Repositories/ActiveRepository".update_everything() # FIXME diff --git a/terminal.tscn b/terminal.tscn index 6b37128..28bbd6f 100644 --- a/terminal.tscn +++ b/terminal.tscn @@ -4,10 +4,18 @@ [ext_resource path="res://terminal.gd" type="Script" id=2] [ext_resource path="res://command_button.tscn" type="PackedScene" id=4] -[sub_resource type="StyleBoxFlat" id=1] +[sub_resource type="StyleBoxFlat" id=2] +content_margin_left = 10.0 +content_margin_right = 10.0 +content_margin_top = 10.0 +content_margin_bottom = 10.0 bg_color = Color( 0, 0, 0, 1 ) -[sub_resource type="StyleBoxFlat" id=2] +[sub_resource type="StyleBoxFlat" id=1] +content_margin_left = 10.0 +content_margin_right = 10.0 +content_margin_top = 10.0 +content_margin_bottom = 5.0 bg_color = Color( 0, 0, 0, 1 ) [node name="Terminal" type="Container"] @@ -26,17 +34,13 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Output" type="TextEdit" parent="Control"] +[node name="Output" type="RichTextLabel" parent="Control"] margin_right = 1920.0 -margin_bottom = 1054.0 -focus_mode = 0 +margin_bottom = 1039.0 size_flags_vertical = 3 -custom_styles/read_only = SubResource( 1 ) -custom_fonts/font = ExtResource( 1 ) -readonly = true -__meta__ = { -"_edit_use_anchors_": false -} +custom_styles/normal = SubResource( 2 ) +custom_fonts/normal_font = ExtResource( 1 ) +scroll_following = true [node name="Button" parent="Control" instance=ExtResource( 4 )] visible = false @@ -62,10 +66,10 @@ text = "git checkout HEAD^" align = 0 [node name="Input" type="LineEdit" parent="Control"] -margin_top = 1054.0 +margin_top = 1039.0 margin_right = 1920.0 margin_bottom = 1080.0 -custom_styles/normal = SubResource( 2 ) +custom_styles/normal = SubResource( 1 ) custom_fonts/font = ExtResource( 1 ) caret_blink = true __meta__ = {