File tree 3 files changed +27
-13
lines changed
3 files changed +27
-13
lines changed Original file line number Diff line number Diff line change @@ -229,12 +229,14 @@ def say msg
229
229
def key_pressed
230
230
begin
231
231
# this "raw input" nonsense is because unix likes waiting for linefeeds before sending stdin
232
- system ( "stty raw" ) # turn raw input on
232
+
233
+ # 'raw' means turn raw input on
233
234
234
235
# restore proper output newline handling -- see stty.rb and "man stty" and /usr/include/sys/termios.h
235
236
# looks like "raw" flips off the OPOST bit 0x00000001 /* enable following output processing */
236
237
# which disables #define ONLCR 0x00000002 /* map NL to CR-NL (ala CRMOD) */
237
- system ( "stty gfmt1:oflag=3" )
238
+ # so this sets it back on again since all we care about is raw input, not raw output
239
+ system ( "stty raw opost" )
238
240
239
241
c = nil
240
242
if $stdin. ready?
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ $spec = Gem::Specification.new do |s|
3
3
s . required_rubygems_version = Gem ::Requirement . new ( ">= 0" ) if s . respond_to? :required_rubygems_version=
4
4
5
5
s . name = 'rerun'
6
- s . version = '0.6.4 '
6
+ s . version = '0.6.5 '
7
7
8
8
s . description = "Restarts your app when a file changes"
9
9
s . summary = "Launches an app, and restarts it whenever the filesystem changes."
Original file line number Diff line number Diff line change 8
8
stty . split ( ':' )
9
9
end
10
10
11
-
12
11
def tty_setting name
13
12
tty . grep ( /^#{ name } / ) . first . split ( '=' ) . last
14
13
end
@@ -18,29 +17,42 @@ def oflag
18
17
end
19
18
20
19
normal = tty
20
+
21
21
`stty raw`
22
22
raw = tty
23
+
23
24
`stty -raw`
24
- post_raw = tty
25
- assert { post_raw == normal }
25
+ minus_raw = tty
26
+ assert { minus_raw == normal }
27
+
28
+ `stty raw opost`
29
+ raw_opost = tty
26
30
27
31
d { raw - normal }
28
32
d { normal - raw }
33
+ d { normal - raw_opost }
29
34
30
35
puts "== normal"
31
36
# d { tty }
32
37
d { oflag }
33
38
34
39
def check setting
35
- `stty gfmt1: #{ setting } `
40
+ `stty #{ setting } `
36
41
puts "testing #{ setting } :\n line\n line"
42
+ print "\r \n "
37
43
end
38
44
39
- puts "== raw"
40
- `stty raw`
41
- puts "testing\n raw\n mode"
45
+ check "raw"
46
+
47
+ check "-raw"
48
+
49
+ check "raw opost"
50
+
51
+ check "-raw"
52
+
53
+ check "raw gfmt1:oflag=3"
42
54
43
- check "oflag=3"
44
- check "lflag=200005cb"
45
- check "iflag=2b02"
55
+ # check "oflag=3"
56
+ # check "lflag=200005cb"
57
+ # check "iflag=2b02"
46
58
`stty -raw`
You can’t perform that action at this time.
0 commit comments