From ab72cab59bfbc9301baefef586431e587ae335e9 Mon Sep 17 00:00:00 2001 From: Davor Ocelic Date: Thu, 21 Apr 2022 12:00:13 +0200 Subject: [PATCH] Update for Term::Screen --- shard.yml | 2 +- src/tput.cr | 2 +- src/tput/coordinates.cr | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/shard.yml b/shard.yml index c5344c7..7d26413 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: tput -version: 1.0.3 +version: 1.0.4 authors: - Davor Ocelic diff --git a/src/tput.cr b/src/tput.cr index 8856ade..1725be0 100644 --- a/src/tput.cr +++ b/src/tput.cr @@ -45,7 +45,7 @@ require "./tput/emulator" # In all of the examples above, spaces exist just for clarity and are not part of actual escape # sequences. For example, in "ESC [" or " Ps ; Ps ;" there are no actual spaces. class Tput - VERSION = "1.0.3" + VERSION = "1.0.4" include Namespace include JSON::Serializable include Crystallabs::Helpers::Logging diff --git a/src/tput/coordinates.cr b/src/tput/coordinates.cr index dbf198e..3e7fc15 100644 --- a/src/tput/coordinates.cr +++ b/src/tput/coordinates.cr @@ -6,7 +6,9 @@ class Tput # Gets terminal/screen size as number of columns and rows. def get_screen_size r, c = ENV["TPUT_SCREEN_SIZE"]?.try { |s| s.split('x', 2).map &.to_i } || - Term::Screen.size_from_ioctl || + Term::Screen.size_from_ioctl(STDIN) || + Term::Screen.size_from_ioctl(STDOUT) || + Term::Screen.size_from_ioctl(STDERR) || Term::Screen.size_from_env || Term::Screen.size_from_ansicon || {DEFAULT_SCREEN_SIZE.height, DEFAULT_SCREEN_SIZE.width}