From a0a7202684ebea14e51e02495c8e5e5e3450642c Mon Sep 17 00:00:00 2001 From: bleeptrack Date: Tue, 6 Oct 2020 12:30:24 +0200 Subject: [PATCH] Autosizing of completions --- terminal.gd | 6 ++++++ terminal.tscn | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/terminal.gd b/terminal.gd index 67b1b1c..d77d51e 100644 --- a/terminal.gd +++ b/terminal.gd @@ -134,6 +134,7 @@ func regenerate_completions_menu(new_text): completions.clear() + var filtered_comp = [] for c in comp: if c != new_text: @@ -153,6 +154,11 @@ func regenerate_completions_menu(new_text): var idx = git_commands.find(subcommand) if idx >= 0: child.set_text(1, git_commands_help[idx]) + + completions.margin_top = -min(filtered_comp.size() * 35 + 10, 210) + + + func relevant_subcommands(): var result = {} diff --git a/terminal.tscn b/terminal.tscn index 3924f3c..08ddb27 100644 --- a/terminal.tscn +++ b/terminal.tscn @@ -56,7 +56,7 @@ __meta__ = { anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -margin_top = -223.0 +margin_top = -311.0 columns = 2 hide_root = true __meta__ = {