Skip to content

Commit

Permalink
Add doc about ed-kill-line, kill-line, em-kill-line, and unix-line-di…
Browse files Browse the repository at this point in the history
…scard
  • Loading branch information
aycabta committed Sep 26, 2021
1 parent 5936071 commit 586a48f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2513,6 +2513,11 @@ def finish
end
alias_method :backward_delete_char, :em_delete_prev_char

# Editline:: +ed-kill-line+ (vi command: +D+, +Ctrl-K+; emacs: +Ctrl-K+,
# +Ctrl-U+) + Kill from the cursor to the end of the line.
# GNU Readline:: +kill-line+ (+C-k+) Kill the text from point to the end of
# the line. With a negative numeric argument, kill backward
# from the cursor to the beginning of the current line.
private def ed_kill_line(key)
if @line.bytesize > @byte_pointer
@line, deleted = byteslice!(@line, @byte_pointer, @line.bytesize - @byte_pointer)
Expand All @@ -2531,6 +2536,10 @@ def finish
end
alias_method :kill_line, :ed_kill_line

# Editline:: +em-kill-line+ (not bound) Delete the entire contents of the
# edit buffer and save it to the cut buffer. +vi-kill-line-prev+
# GNU Readline:: +unix-line-discard+ (+C-u+) Kill backward from the cursor
# to the beginning of the current line.
private def em_kill_line(key)
if @byte_pointer > 0
@line, deleted = byteslice!(@line, 0, @byte_pointer)
Expand Down

0 comments on commit 586a48f

Please sign in to comment.