lib/tty/cursor.rb in tty-cursor-0.1.0 vs lib/tty/cursor.rb in tty-cursor-0.2.0
- old
+ new
@@ -134,12 +134,12 @@
# @param [Symbol] :direction
# the direction to clear, default :up
#
# @api public
def clear_lines(count, direction = :up)
- count.times.reduce('') do |acc|
+ count.times.reduce('') do |acc, i|
dir = direction == :up ? up : down
- acc << dir + clear_line
+ acc << clear_line + ((i == count - 1) ? '' : dir)
end
end
alias_method :clear_rows, :clear_lines
# Clear screen down from current position