Method: TTY::Reader::Line#prompt_size

Defined in:
lib/tty/reader/line.rb

#prompt_sizeObject

Prompt size


238
239
240
241
242
243
# File 'lib/tty/reader/line.rb', line 238

def prompt_size
  p = self.class.sanitize(@prompt).split(/\r?\n/)
  # return the length of each line + screen width for every line past the first
  # which accounts for multi-line prompts
  p.join.length + ((p.length - 1) * TTY::Screen.width )
end