lib/vedeu/input/editor/editor.rb in vedeu-0.6.0 vs lib/vedeu/input/editor/editor.rb in vedeu-0.6.1
- old
+ new
@@ -17,14 +17,16 @@
:insert_character,
:insert_line,
:left,
:render,
:reset!,
- :retrieve,
+ :execute,
:right,
:up
+ # Send given input to the named document.
+ #
# @param name [String]
# @param input [String|Symbol]
# @return [void]
def self.keypress(input:, name:)
new(input: input, name: name).keypress
@@ -38,10 +40,12 @@
def initialize(input:, name:)
@input = input
@name = name
end
+ # Send given input to the named document.
+ #
# @return [String|Symbol]
def keypress
return input unless document
case input
@@ -50,18 +54,16 @@
when :down then down
when :enter then insert_line
when :escape then Vedeu.trigger(:_mode_switch_)
when :left then left
when :right then right
- when :tab then command
+ when :tab then execute
when :up then up
# when '' then delete_line
else
insert_character(input)
end
-
- render unless input == :enter
end
protected
# @!attribute [r] input
@@ -71,21 +73,9 @@
# @!attribute [r] name
# @return [String]
attr_reader :name
private
-
- #
- # @return []
- def command
- command = retrieve
-
- reset!
-
- clear
-
- Vedeu.trigger(:_command_, command)
- end
# Return the document by name from the documents repository.
#
# @return [Vedeu::Editor::Document]
def document