rbtext 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbtext/screen.rb +12 -0
  3. data/lib/rbtext.rb +2 -1
  4. metadata +19 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c7c45db810d1c18c792fc0cb8c950a98b595f1e8b2f11f9a52cbd1208ec1b20
4
- data.tar.gz: 7ea21e0558cecc832e0880cc8912c30b7a3ad71187826e4ecd74eb3761570a83
3
+ metadata.gz: ccdee9f23008ced0f1bdc97a19f38fa63328a34c627c002c516b7e8eab6fd12b
4
+ data.tar.gz: 5bd460e3387683c628310b351b377ac614672cdf697da0d0f136cfdee04bd148
5
5
  SHA512:
6
- metadata.gz: 8ec67a8716005d493a6f67e279452d5bf782af7bc7d1660bbccd6c7d81cc2f496ee5fd325957bbd884130ab8ae32139d3763a44a4426a70d02ed4819d7621ca9
7
- data.tar.gz: 92971efd9ce33efa7f914022ccc0f3fbcce48047438c96085a19c997d74a92f5f1141e698dda11e617d8dc0864c65714b83d21befa795cce2f92b22e01acd0af
6
+ metadata.gz: 2510193ee742687619d2655a3b744f929ea0af609a6840d2d53001bbeef642a188c122ae4fcc2b5279ce2157b5ca00451cf0a21c8f988d16fdf62b11b94d1b3c
7
+ data.tar.gz: aa33777189a62c0acaf2b6a30361db34b419404e9bcc9061f8d17ea534529b0a39855c103cb4281772e6cea581a6306af7ba91588f595cbd515c4d543104852d
data/lib/rbtext/screen.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  module RBText
2
2
  module Screen
3
+ @@key_press_mappings = {:escape=>"\e", :f1=>"\eOP", :f2=>"\eOQ", :f3=>"\eOR", :f4=>"\eOS", :f5=>"\e[15~", :f6=>"\e[17~", :f7=>"\e[18~", :f8=>"\e[19~", :f9=>"\e[20~", :f10=>"\e[21~", :f11=>"\e[23~", :f12=>"\e[24~", :home=>"\e[1~", :end=>"\e[4~", :insert=>"\e[2~", :delete=>"\e[3~", "~"=>"~", "!"=>"!", "@"=>"@", "#"=>"#", "$"=>"$", "%"=>"%", "^"=>"^", "&"=>"&", "*"=>"*", "("=>"(", ")"=>")", "_"=>"_", "+"=>"+", :backspace=>"\u007F", "`"=>"`", "1"=>"1", "2"=>"2", "3"=>"3", "4"=>"4", "5"=>"5", "6"=>"6", "7"=>"7", "8"=>"8", "9"=>"9", "0"=>"0", "-"=>"-", "="=>"=", :tab=>"\t", "q"=>"q", "Q"=>"Q", :"ctrl-q"=>"\u0011", "w"=>"w", "W"=>"W", :"ctrl-w"=>"\u0017", "e"=>"e", "E"=>"E", :"ctrl-e"=>"\u0005", "r"=>"r", "R"=>"R", :"ctrl-r"=>"\u0012", "t"=>"t", "T"=>"T", :"ctrl-t"=>"\u0014", "y"=>"y", "Y"=>"Y", :"ctrl-y"=>"\u0019", "u"=>"u", "U"=>"U", :"ctrl-u"=>"\u0015", "i"=>"i", "I"=>"I", :"ctrl-i"=>"\t", "o"=>"o", "O"=>"O", :"ctrl-o"=>"\u000F", "p"=>"p", "P"=>"P", :"ctrl-p"=>"\u0010", "["=>"[", "]"=>"]", "\\"=>"\\", "{"=>"{", "}"=>"}", "|"=>"|", "a"=>"a", "A"=>"A", :"ctrl-a"=>"\u0001", "s"=>"s", "S"=>"S", :"ctrl-s"=>"\u0013", "d"=>"d", "D"=>"D", :"ctrl-d"=>"\u0004", "f"=>"f", "F"=>"F", :"ctrl-f"=>"\u0006", "g"=>"g", "G"=>"G", :"ctrl-g"=>"\a", "h"=>"h", "H"=>"H", :"ctrl-h"=>"\b", "j"=>"j", "J"=>"J", :"ctrl-j"=>"\n", "k"=>"k", "K"=>"K", :"ctrl-k"=>"\v", "l"=>"l", "L"=>"L", :"ctrl-l"=>"\f", ";"=>";", "'"=>"'", ":"=>":", "\""=>"\"", :enter=>"\r", "z"=>"z", "Z"=>"Z", :"ctrl-z"=>"\u001A", "x"=>"x", "X"=>"X", :"ctrl-x"=>"\u0018", "c"=>"c", "C"=>"C", :"ctrl-c"=>"\u0003", "v"=>"v", "V"=>"V", :"ctrl-v"=>"\u0016", "b"=>"b", "B"=>"B", :"ctrl-b"=>"\u0002", "n"=>"n", "N"=>"N", :"ctrl-n"=>"\u000E", "m"=>"m", "M"=>"M", :"ctrl-m"=>"\r", ","=>",", "."=>".", "/"=>"/", "<"=>"<", ">"=>">", "?"=>"?", :up=>"\e[A", :down=>"\e[B", :left=>"\e[D", :right=>"\e[C", :pageup=>"\e[5~", :pagedown=>"\e[6~"}
4
+
3
5
  def self.clear
4
6
  print "\033[2J"
5
7
  end
@@ -23,6 +25,16 @@ module RBText
23
25
  def self.bell
24
26
  print "\a"
25
27
  end
28
+
29
+ def self.getch
30
+ out = STDIN.getch
31
+
32
+ while STDIN.ready? do
33
+ out << STDIN.getch
34
+ end
35
+
36
+ return @@key_press_mappings.key(out)
37
+ end
26
38
  end
27
39
  end
28
40
 
data/lib/rbtext.rb CHANGED
@@ -4,11 +4,12 @@ require_relative "rbtext/formatting.rb"
4
4
  require_relative "rbtext/ftext.rb"
5
5
  require_relative "rbtext/screen.rb"
6
6
  require "io/console"
7
+ require "io/wait"
7
8
 
8
9
  module RBText
9
10
  @ver_1 = 0
10
11
  @ver_2 = 3
11
- @ver_3 = 3
12
+ @ver_3 = 4
12
13
  @ver_4 = ""
13
14
 
14
15
  def self.version
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbtext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-14 00:00:00.000000000 Z
11
+ date: 2024-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: io-console
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.5.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.5.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: io-wait
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: argparse
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
86
  - !ruby/object:Gem::Version
73
87
  version: '0'
74
88
  requirements: []
75
- rubygems_version: 3.1.6
89
+ rubygems_version: 3.2.3
76
90
  signing_key:
77
91
  specification_version: 4
78
92
  summary: RBText