surround will stop when no matching parentheses pair was found
This commit is contained in:
parent
ae9c4e2a60
commit
33c04f530d
2 changed files with 8 additions and 2 deletions
|
@ -230,7 +230,12 @@ module Diakonos
|
|||
pair = r_parentheses.select { |r, p| args[:parenthesis] =~ r }.values[0]
|
||||
pair = pair.call(args[:parenthesis]) if pair.is_a? Proc
|
||||
|
||||
pair[0] + text.join("\n") + pair[1]
|
||||
if pair.nil?
|
||||
$diakonos.set_iline "No matching parentheses pair found."
|
||||
return nil
|
||||
else
|
||||
return pair[0] + text.join("\n") + pair[1]
|
||||
end
|
||||
end
|
||||
|
||||
def join_lines_upward( row = @last_row, strip = DONT_STRIP_LINE )
|
||||
|
|
|
@ -28,7 +28,8 @@ module Diakonos
|
|||
|
||||
def surround_selection
|
||||
parenthesis = get_user_input("Parenthesis: ")
|
||||
@current_buffer.paste @current_buffer.surround(@current_buffer.selected_text, :parenthesis => parenthesis)
|
||||
text = @current_buffer.surround(@current_buffer.selected_text, :parenthesis => parenthesis)
|
||||
@current_buffer.paste text if text
|
||||
end
|
||||
|
||||
def surround_word
|
||||
|
|
Loading…
Reference in a new issue