Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/reline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,6 @@ def readline(prompt = '', add_hist = false)
line_editor.auto_indent_proc = auto_indent_proc
line_editor.dig_perfect_match_proc = dig_perfect_match_proc

# Readline calls pre_input_hook just after printing the first prompt.
line_editor.print_nomultiline_prompt
pre_input_hook&.call

unless Reline::IOGate.dumb?
Expand Down
8 changes: 0 additions & 8 deletions lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,6 @@ def render_finished
end
end

def print_nomultiline_prompt
Reline::IOGate.disable_auto_linewrap(true) if Reline::IOGate.win?
# Readline's test `TestRelineAsReadline#test_readline` requires first output to be prompt, not cursor reset escape sequence.
Reline::IOGate.write Reline::Unicode.strip_non_printing_start_end(@prompt) if @prompt && !@is_multiline
ensure
Reline::IOGate.disable_auto_linewrap(false) if Reline::IOGate.win?
end

def render
wrapped_cursor_x, wrapped_cursor_y = wrapped_cursor_position
new_lines = wrapped_prompt_and_input_lines.flatten(1)[screen_scroll_top, screen_height].map do |prompt, line|
Expand Down
12 changes: 0 additions & 12 deletions test/reline/test_reline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,18 +382,6 @@ def test_dumb_terminal
assert_match(/#<Reline::Dumb/, out.chomp)
end

def test_print_prompt_before_everything_else
pend if win?
lib = File.expand_path("../../lib", __dir__)
code = "p Reline::IOGate.class; p Reline.readline 'prompt> '"
out = IO.popen([Reline.test_rubybin, "-I#{lib}", "-rreline", "-e", code], "r+") do |io|
io.write "abc\n"
io.close_write
io.read
end
assert_match(/\AReline::ANSI\nprompt> /, out)
end

def test_read_eof_returns_input
pend if win?
lib = File.expand_path("../../lib", __dir__)
Expand Down