Skip to content

Commit

Permalink
Ignore NUL by ed_quoted_insert
Browse files Browse the repository at this point in the history
  • Loading branch information
aycabta committed Sep 26, 2021
1 parent 5936071 commit 43b7c01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,8 @@ def finish
arg.times do
if key == "\C-j".ord or key == "\C-m".ord
key_newline(key)
elsif key == 0
# Ignore NUL.
else
ed_insert(key)
end
Expand Down
7 changes: 7 additions & 0 deletions test/reline/test_key_actor_emacs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2285,6 +2285,13 @@ def test_ed_search_prev_next_history_in_multibyte
assert_line(' 12345')
end

def test_ignore_NUL_by_ed_quoted_insert
input_keys(%Q{"\C-v\C-@"}, false)
assert_byte_pointer_size('""')
assert_cursor(2)
assert_cursor_max(2)
end

def test_input_unknown_char
input_keys('͸') # U+0378 (unassigned)
assert_line('͸')
Expand Down

0 comments on commit 43b7c01

Please sign in to comment.