Skip to content
Kward Search API index

Class: Kward::PromptInterface::VibeEditorState

Inherits:
Object
  • Object
show all
Defined in:
lib/kward/prompt_interface/editor/vibe_state.rb

Overview

Modal Vibe editor state for one editor buffer.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(editor_mode: "modern") ⇒ VibeEditorState

Returns a new instance of VibeEditorState.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 12

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 = {}
  @register_types = {}
  @kill_linewise = false
  @previous_change_cursor = nil
  @jump_back_list = []
  @jump_forward_list = []
  @macros = {}
  @recording_macro = nil
  @last_macro = nil
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



7
8
9
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 7

def command
  @command
end

#jump_back_listObject

Returns the value of attribute jump_back_list.



10
11
12
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 10

def jump_back_list
  @jump_back_list
end

#jump_forward_listObject

Returns the value of attribute jump_forward_list.



10
11
12
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 10

def jump_forward_list
  @jump_forward_list
end

#kill_linewiseObject

Returns the value of attribute kill_linewise.



10
11
12
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 10

def kill_linewise
  @kill_linewise
end

#last_changeObject

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_findObject

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_macroObject

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_selectionObject

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

#macrosObject

Returns the value of attribute macros.



9
10
11
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 9

def macros
  @macros
end

#marksObject

Returns the value of attribute marks.



9
10
11
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 9

def marks
  @marks
end

#modeObject

Returns the value of attribute mode.



7
8
9
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 7

def mode
  @mode
end

#pendingObject

Returns the value of attribute pending.



7
8
9
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 7

def pending
  @pending
end

#previous_change_cursorObject

Returns the value of attribute previous_change_cursor.



10
11
12
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 10

def previous_change_cursor
  @previous_change_cursor
end

#recording_macroObject

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

#register_typesObject

Returns the value of attribute register_types.



9
10
11
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 9

def register_types
  @register_types
end

#registersObject

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_insertObject

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



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/kward/prompt_interface/editor/vibe_state.rb', line 32

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.register_types = other.register_types.transform_values(&:dup)
  state.kill_linewise = other.kill_linewise
  state.previous_change_cursor = other.previous_change_cursor
  state.jump_back_list = other.jump_back_list.map(&:dup)
  state.jump_forward_list = other.jump_forward_list.map(&:dup)
  state.macros = other.macros.transform_values(&:dup)
  state.recording_macro = other.recording_macro
  state.last_macro = other.last_macro
  state
end