Skip to content

Commit

Permalink
No need to calculate indentation if it's the first line
Browse files Browse the repository at this point in the history
  • Loading branch information
andrehjr committed Mar 29, 2024
1 parent 49b913e commit 08753a9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/pry/repl.rb
Expand Up @@ -206,10 +206,14 @@ def input_reline(*args)
end

if pry.config.auto_indent
Reline.auto_indent_proc = lambda do |lines, _line_index, _byte_pointer, _newline|
pry_indentation = Pry::Indent.new
pry_indentation.indent(lines.join("\n"))
pry_indentation.last_indent_level.length
Reline.auto_indent_proc = lambda do |lines, line_index, _byte_pointer, _newline|
if line_index == 0
0
else
pry_indentation = Pry::Indent.new
pry_indentation.indent(lines.join("\n"))
pry_indentation.last_indent_level.length
end
end
end

Expand Down

0 comments on commit 08753a9

Please sign in to comment.