Keyboard macros: Difference between revisions
Content added Content deleted
(add Ruby) |
m (→{{header|Ruby}}: expand example a bit) |
||
Line 294: | Line 294: | ||
keypress do |key| |
keypress do |key| |
||
case key |
case key |
||
when \ |
when "\x04" # control-d |
||
delete_char |
|||
when :backspace |
|||
delete_previous_char |
|||
when "\x14" # control-t |
|||
transpose_chars |
|||
when :alt_t |
|||
transpose_words |
|||
when "\x18" # control-x |
|||
@ctrl_x = true |
@ctrl_x = true |
||
when \x13 # control-s |
when "\x13" # control-s |
||
if @ctrl_x |
if @ctrl_x |
||
save_text |
save_text |
||
@ctrl_x = false |
@ctrl_x = false |
||
end |
end |
||
when \x11 # control-q |
when "\x11" # control-q |
||
exit if @ctrl_x |
exit if @ctrl_x |
||
end |
end |