1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

special-case Windows for ANSI codes :(

This commit is contained in:
Ryan Fitzgerald 2011-10-27 23:43:55 -07:00
parent ec7d0d055e
commit 4f2a496399

View file

@ -195,9 +195,14 @@ class Pry
lines = 1
end
move_up = "\e[#{lines}A\e[0G"
if defined?(Win32::Console)
move_up = "\e[#{lines}F"
move_down = "\e[#{lines}E"
else
move_up = "\e[#{lines}A\e[0G"
move_down = "\e[#{lines}B\e[0G"
end
whitespace = ' ' * overhang
move_down = "\e[#{lines}B\e[0G"
"#{move_up}#{full_line}#{whitespace}#{move_down}"
end