Skip to content

Commit

Permalink
Follow up: Fixed bug: Some prompts eat previous console lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsteneckel committed May 20, 2016
1 parent 22dfdb4 commit 66bf38a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/inquirer/utils/iohelper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def render prompt, bottomline = nil
print IOChar.newline * lines + @bottomline + IOChar.cursor_left * @bottomline.size + IOChar.cursor_up * lines
end
print @rendered

plain_last_line = plain_chars(@rendered.lines.last)
print IOChar.newline + IOChar.cursor_up + IOChar.cursor_right * plain_last_line.length
end

# clear the console based on the last text rendered
Expand Down Expand Up @@ -124,4 +127,8 @@ def wrap(string)

result + IOChar.clear_line
end

def plain_chars(string)
string.gsub(/\e\[([;\dA-Z]+)?m?/, '')
end
end

0 comments on commit 66bf38a

Please sign in to comment.