summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <[email protected]>2021-03-23 00:56:32 +0900
committeraycabta <[email protected]>2021-03-24 15:43:19 +0900
commit4b33d860e84f0a5efeefbf8a68324801a0215a08 ()
tree3dec8ac66711a22387ea5bd079fbcb301f4ae679
parentb764c8d3c05170214802a947b2fd32c91c6cfd68 (diff)
[ruby/reline] Reline.delete_text removes the current line in multiline
https://.com/ruby/reline/commit/da90c094a1
-rw-r--r--lib/reline/line_editor.rb30
-rw-r--r--test/reline/test_within_pipe.rb13
2 files changed, 39 insertions, 4 deletions
@@ -1291,10 +1291,32 @@ class Reline::LineEditor
def delete_text(start = nil, length = nil)
if start.nil? and length.nil?
- @line&.clear
- @byte_pointer = 0
- @cursor = 0
- @cursor_max = 0
elsif not start.nil? and not length.nil?
if @line
before = @line.byteslice(0, start)
@@ -59,4 +59,17 @@ class Reline::WithinPipeTest < Reline::TestCase
@writer.write("abcde\C-b\C-b\C-b\C-x\C-d\C-x\C-h\C-x\C-v\C-a\C-f\C-f EF\C-x\C-t gh\C-x\M-t\C-b\C-b\C-b\C-b\C-b\C-b\C-b\C-b\C-x\M-u\C-x\M-l\C-x\M-c\n")
assert_equal "a\C-aDE gh Fe", Reline.readmultiline(&proc{ true })
end
end