mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Strip ansi codes from prompt before measuring [Issue #493]
This commit is contained in:
parent
293aafd4ea
commit
731d0cf20d
1 changed files with 2 additions and 2 deletions
|
@ -384,13 +384,13 @@ class Pry
|
|||
# @return [String]
|
||||
def correct_indentation(prompt, code, overhang=0)
|
||||
prompt = prompt.delete("\001\002")
|
||||
full_line = prompt + code
|
||||
line_to_measure = Pry::Helpers::Text.strip_color(prompt) + code
|
||||
whitespace = ' ' * overhang
|
||||
|
||||
_, cols = Terminal.screen_size
|
||||
|
||||
cols = cols.to_i
|
||||
lines = cols != 0 ? (full_line.length / cols + 1) : 1
|
||||
lines = cols != 0 ? (line_to_measure.length / cols + 1) : 1
|
||||
|
||||
if Pry::Helpers::BaseHelpers.windows_ansi?
|
||||
move_up = "\e[#{lines}F"
|
||||
|
|
Loading…
Reference in a new issue