^x for special chars
This commit is contained in:
parent
dda10f494f
commit
71e504e273
1 changed files with 6 additions and 3 deletions
9
mewny.rb
9
mewny.rb
|
|
@ -173,10 +173,13 @@ def do_client
|
||||||
end
|
end
|
||||||
|
|
||||||
while (char = STDIN.noecho(&:getch))
|
while (char = STDIN.noecho(&:getch))
|
||||||
exit unless char != "\x03" # ^C
|
|
||||||
exit unless char != "\x04" # ^D
|
exit unless char != "\x04" # ^D
|
||||||
next unless char.ord >= 0x20 # Non printing
|
if char.ord < 0x20 # Non printing
|
||||||
next unless char.ord != 0x7F # DEL (Non print)
|
char = '^'+(char.ord + 0x40).chr
|
||||||
|
elsif char.ord == 0x7F # DEL (Non print)
|
||||||
|
char = '^?'
|
||||||
|
end
|
||||||
|
next unless
|
||||||
socket.puts "#{VERSION}|#{char}"
|
socket.puts "#{VERSION}|#{char}"
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue