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 +4 -4
- data/lib/chess/mouse/mouse_input.rb +12 -5
- data/lib/chess/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0931a7e54a726d77f7363254da08b9a8d91664a3b38f5eb7dfd1d267d4ce18ca'
|
|
4
|
+
data.tar.gz: 7a0000a3faf6ff246bde73bca97ea4cc8c5800efc6275b3c6d252da9c216d1a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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[?
|
|
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[?
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
sequence
|
|
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