chess_tui 0.41.5 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 506b56e49a24e1406c94c1657c56c96d697996e0167c10311f885d85d07a16eb
4
- data.tar.gz: f76b24bbd7c713dcb779863a90de100a3a4fbd76521e6c24497c0d570d332da6
3
+ metadata.gz: '0931a7e54a726d77f7363254da08b9a8d91664a3b38f5eb7dfd1d267d4ce18ca'
4
+ data.tar.gz: 7a0000a3faf6ff246bde73bca97ea4cc8c5800efc6275b3c6d252da9c216d1a0
5
5
  SHA512:
6
- metadata.gz: 9ce9a48e8998b7e397a348e8ce99d0cc16fe44543a738f3b3518091c770b23e81faf22c3453cf25c729fec86d429c5e07fed50b2a19290043e03790f8ae67df4
7
- data.tar.gz: 89b169ef16689315f5320b954ad1425e6ab873ff2e44b93f253a7c5c15cf14afcf5c308d9df4037f15a92421970e3fa3d4900590078d667e88ac95696ca6ffb9
6
+ metadata.gz: 71df83c5b53f659bf11180ae767d08bf8d1384fbd7f09a3231b49b36d7653dd9629ad3d09c9dbec5d82c635ead084478ae3511906ff2e85d7f38dd85023fff9d
7
+ data.tar.gz: 71d09b306fa75bba218874de9a783f60560bb445f3c22be91999b639aa9212f06ad8691726a107bedbc8b02fdd7a33d741bfee97d142fc40ac5e151f7d71b7ef
@@ -27,13 +27,15 @@ module Chess
27
27
  # enable the mouse tracking using xterm control sequences -
28
28
  # https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
29
29
  def enable_mouse_tracking
30
- print "\e[?9h" # Enable X10 mouse tracking
30
+ print "\e[?1000h" # Enable normal mouse tracking
31
+ print "\e[?1006h" # Enable SGR mouse tracking
31
32
  end
32
33
 
33
34
  # disable the mouse tracking using xterm control sequences -
34
35
  # https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking
35
36
  def disable_mouse_tracking
36
- print "\e[?9l" # Disable X10 mouse tracking
37
+ print "\e[?1006l" # Disable SGR mouse tracking
38
+ print "\e[?1000l" # Disable normal mouse tracking
37
39
  end
38
40
 
39
41
  # runs loop for mouse input
@@ -57,9 +59,14 @@ module Chess
57
59
  # @param char [Char]
58
60
  # @return [Array(x,y)]
59
61
  def read_input(char)
60
- shift = 32
61
- sequence = char + $stdin.read(5) # Read the full ESC [ M SPACE Cx Cy stored in buffer
62
- sequence.bytes[4..].map { |e| e - shift } # shift and return the Cx Cy only
62
+ sequence = char + $stdin.read(17)
63
+ # storing anything left out here
64
+ sequence += $stdin.getc while $stdin.ready?
65
+ input = sequence.split(';')
66
+ x = input[1].to_i
67
+ # for y the to_i will only take the first number from e.g "34M[0;12;0" ignoring everything after the first non Integer
68
+ y = input[2].to_i
69
+ [x, y]
63
70
  end
64
71
 
65
72
  # read what was clicked
data/lib/chess/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Chess
4
4
  # VERSION following https://semver.org
5
- VERSION = '0.41.5'
5
+ VERSION = '0.42.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chess_tui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.5
4
+ version: 0.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - X_AJ_X