perl - What does it mean, when Term::ReadKey::ReadKey returns "0"? -
with dumpkeys --long-info
called in linux-terminal these values:
# ... 0x0000 nul 0x0001 control_a 0x0002 control_b 0x0003 control_c 0x0004 control_d # ...
when run script , press ctrl a
or ctrl b
corresponding values.
when press ctrl space
readkey
returns 0
.
null mean value of ctrl space
or mean there not set or empty?
#!/usr/bin/env perl use warnings; use strict; use term::readkey; readmode('cbreak'); print "press keys see ascii values. use ctrl-c quit.\n"; while (1) { $char = readkey(0); last unless defined $char; printf("$char -> hex: %x\n", ord($char), ord($char)); } readmode('normal'); # -> hex: 1 # ctrl # -> hex: 2 # ctrl b # -> hex: 4 # ctrl d # -> hex: 0 # ctrl space
showkey -a
shows me
^a 1 0001 0x01 # ctrl ^b 2 0002 0x02 # ctrl b ^@ 0 0000 0x00 # ctrl space
and in this answer said ctrlspace sends ascii nul i'm assuming 0 ctrlspace 1 ctrla
Comments
Post a Comment