class Pry::REPL

def calculate_overhang(current_prompt, original_val, indented_val)

Other tags:
    Note: - This doesn't calculate overhang for Readline's emacs mode with an

Returns:
  • (Integer) -
def calculate_overhang(current_prompt, original_val, indented_val)
  overhang = original_val.length - indented_val.length
  if readline_available? && Readline.respond_to?(:vi_editing_mode?)
    begin
      # rb-readline doesn't support this method:
      # https://github.com/ConnorAtherton/rb-readline/issues/152
      if Readline.vi_editing_mode?
        overhang = output.width - current_prompt.size - indented_val.size
      end
    rescue NotImplementedError
      # VI editing mode is unsupported on JRuby.
      # https://github.com/pry/pry/issues/1840
      nil
    end
  end
  [0, overhang].max
end