Class: Kward::PromptInterface::VibeEditorState
- Inherits:
-
Object
- Object
- Kward::PromptInterface::VibeEditorState
- Defined in:
- lib/kward/prompt_interface/editor/vibe_state.rb
Overview
Modal Vibe editor state for one editor buffer.
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#last_change ⇒ Object
Returns the value of attribute last_change.
-
#last_find ⇒ Object
Returns the value of attribute last_find.
-
#last_macro ⇒ Object
Returns the value of attribute last_macro.
-
#last_visual_selection ⇒ Object
Returns the value of attribute last_visual_selection.
-
#macros ⇒ Object
Returns the value of attribute macros.
-
#marks ⇒ Object
Returns the value of attribute marks.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#pending ⇒ Object
Returns the value of attribute pending.
-
#recording_macro ⇒ Object
Returns the value of attribute recording_macro.
-
#registers ⇒ Object
Returns the value of attribute registers.
-
#visual_block_insert ⇒ Object
Returns the value of attribute visual_block_insert.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(editor_mode: "modern") ⇒ VibeEditorState
constructor
A new instance of VibeEditorState.
Constructor Details
#initialize(editor_mode: "modern") ⇒ VibeEditorState
Returns a new instance of VibeEditorState.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 11 def initialize(editor_mode: "modern") @mode = editor_mode == "vibe" ? "normal" : nil @pending = "" @command = "" @last_change = nil @last_find = nil @last_visual_selection = nil @visual_block_insert = nil @marks = {} @registers = {} @macros = {} @recording_macro = nil @last_macro = nil end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
7 8 9 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 7 def command @command end |
#last_change ⇒ Object
Returns the value of attribute last_change.
7 8 9 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 7 def last_change @last_change end |
#last_find ⇒ Object
Returns the value of attribute last_find.
7 8 9 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 7 def last_find @last_find end |
#last_macro ⇒ Object
Returns the value of attribute last_macro.
9 10 11 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 9 def last_macro @last_macro end |
#last_visual_selection ⇒ Object
Returns the value of attribute last_visual_selection.
8 9 10 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 8 def last_visual_selection @last_visual_selection end |
#macros ⇒ Object
Returns the value of attribute macros.
9 10 11 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 9 def macros @macros end |
#marks ⇒ Object
Returns the value of attribute marks.
9 10 11 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 9 def marks @marks end |
#mode ⇒ Object
Returns the value of attribute mode.
7 8 9 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 7 def mode @mode end |
#pending ⇒ Object
Returns the value of attribute pending.
7 8 9 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 7 def pending @pending end |
#recording_macro ⇒ Object
Returns the value of attribute recording_macro.
9 10 11 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 9 def recording_macro @recording_macro end |
#registers ⇒ Object
Returns the value of attribute registers.
9 10 11 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 9 def registers @registers end |
#visual_block_insert ⇒ Object
Returns the value of attribute visual_block_insert.
8 9 10 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 8 def visual_block_insert @visual_block_insert end |
Class Method Details
.copy(other) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 26 def self.copy(other) state = new(editor_mode: other.mode ? "vibe" : "modern") state.mode = other.mode&.dup state.pending = other.pending.dup state.command = other.command.dup state.last_change = other.last_change&.dup state.last_find = other.last_find&.dup state.last_visual_selection = other.last_visual_selection&.dup state.visual_block_insert = other.visual_block_insert&.dup state.marks = other.marks.transform_values(&:dup) state.registers = other.registers.transform_values(&:dup) state.macros = other.macros.transform_values(&:dup) state.recording_macro = other.recording_macro state.last_macro = other.last_macro state end |