lib/textbringer/utils.rb in textbringer-0.1.7 vs lib/textbringer/utils.rb in textbringer-0.1.8

- old
+ new

@@ -88,10 +88,11 @@ original_buffer: nil, completions_window: nil } def read_from_minibuffer(prompt, completion_proc: nil, default: nil, + initial_value: nil, keymap: MINIBUFFER_LOCAL_MAP) if Window.echo_area.active? raise EditorError, "Command attempted to use minibuffer while in minibuffer" end @@ -102,13 +103,13 @@ old_minibuffer_map = Buffer.minibuffer.keymap Buffer.minibuffer.keymap = keymap Buffer.minibuffer[:completion_proc] = completion_proc Window.echo_area.active = true begin - Buffer.minibuffer.delete_region(Buffer.minibuffer.point_min, - Buffer.minibuffer.point_max) Window.current = Window.echo_area + Buffer.minibuffer.clear + Buffer.minibuffer.insert(initial_value) if initial_value if default prompt = prompt.sub(/:/, " (default #{default}):") end Window.echo_area.prompt = prompt Window.echo_area.redisplay @@ -273,10 +274,19 @@ def ruby_install_name RbConfig::CONFIG["ruby_install_name"] end - def insert(s) - Buffer.current.insert(s) + [ + :beginning_of_buffer?, + :end_of_buffer?, + :beginning_of_line?, + :end_of_line?, + :insert, + :gsub + ].each do |name| + define_method(name) do |*args, &block| + Buffer.current.send(name, *args, &block) + end end end end