Skip to content

Commit

Permalink
Fix #read_timeout= issue; bump to 1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
docelic committed Mar 5, 2023
1 parent 3882fc0 commit 904c860
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: tput
version: 1.0.6
version: 1.0.7

authors:
- Davor Ocelic <[email protected]>
Expand Down
8 changes: 4 additions & 4 deletions src/tput.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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.6"
VERSION = "1.0.7"
include Namespace
include JSON::Serializable
include Crystallabs::Helpers::Logging
Expand All @@ -61,13 +61,13 @@ class Tput
DEFAULT_SCREEN_SIZE = Size.new 80, 24 # Opinions vary: 24, 25, 27

@[JSON::Field(ignore: true)]
property input : IO::FileDescriptor | IO::Memory
property input : IO

@[JSON::Field(ignore: true)]
property output : IO::FileDescriptor | IO::Memory
property output : IO

@[JSON::Field(ignore: true)]
property error : IO::FileDescriptor | IO::Memory
property error : IO

@[JSON::Field(ignore: true)]
@mode : LibC::Termios? = nil
Expand Down
5 changes: 3 additions & 2 deletions src/tput/input.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class Tput

def next_char(timeout : Bool = false)
input = @input
if timeout

if timeout && input.responds_to? :"read_timeout="
input.read_timeout = @read_timeout
end

Expand All @@ -71,7 +72,7 @@ class Tput
yield << c
end

if timeout
if timeout && input.responds_to? :"read_timeout="
input.read_timeout = nil
end

Expand Down

0 comments on commit 904c860

Please sign in to comment.