Skip to content

Commit

Permalink
Check if line empty first in em_delete
Browse files Browse the repository at this point in the history
By distributivity of AND over OR, we can factor out this condition. This
will make the next commit simpler.
  • Loading branch information
etiennebarrie committed Mar 23, 2023
1 parent 3aeea2a commit 865ccbc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2651,7 +2651,7 @@ def finish
alias_method :kill_whole_line, :em_kill_line

private def em_delete(key)
if (not @is_multiline and @line.empty?) or (@is_multiline and @line.empty? and @buffer_of_lines.size == 1)
if @line.empty? and (not @is_multiline or @buffer_of_lines.size == 1)
@line = nil
if @buffer_of_lines.size > 1
scroll_down(@highest_in_all - @first_line_started_from)
Expand Down

0 comments on commit 865ccbc

Please sign in to comment.