lib/tty/prompt/mask_question.rb in tty-prompt-0.11.0 vs lib/tty/prompt/mask_question.rb in tty-prompt-0.12.0
- old
+ new
@@ -60,32 +60,29 @@
elsif @done_masked && @failure
masked = @prompt.decorate(masked, @error_color)
end
header += masked
end
- @prompt.print(header)
- @prompt.puts if @done
-
- header.lines.count + (@done ? 1 : 0)
+ header << "\n" if @done
+ header
end
def render_error(errors)
@failure = !errors.empty?
super
end
# Read input from user masked by character
#
# @private
- def read_input
+ def read_input(question)
@done_masked = false
@failure = false
@input = ''
-
until @done_masked
@prompt.read_keypress
@prompt.print(@prompt.clear_line)
- render_question
+ @prompt.print(render_question)
end
@prompt.puts
@input
end
end # MaskQuestion