Class: Fir::CtrlVCommand
- Inherits:
-
KeyCommand
- Object
- KeyCommand
- Fir::CtrlVCommand
- Defined in:
- lib/fir/key_command/ctrl_v_command.rb
Instance Attribute Summary
Attributes inherited from KeyCommand
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from KeyCommand
build, #execute, for, handles?, inherited, #initialize, register, registry
Constructor Details
This class inherits a constructor from Fir::KeyCommand
Class Method Details
.character_regex ⇒ Object
8 9 10 |
# File 'lib/fir/key_command/ctrl_v_command.rb', line 8 def self.character_regex /^\u0016$/ end |
Instance Method Details
#execute_hook(new_state) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fir/key_command/ctrl_v_command.rb', line 12 def execute_hook(new_state) paste_buffer = `pbpaste` new_state.current_line = state.current_line.clone.insert( state.cursor.x, *paste_buffer.split('') ).flatten new_state.cursor = state.cursor.right(paste_buffer.length) new_state.history.reset new_state end |