Skip to content

Commit

Permalink
clears the screen correctly if showing an image
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Jul 14, 2013
1 parent 9c5e07d commit 9936e86
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions bin/tkn
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ end

# Is this slide an image? (procedural style).
def image?(slide)
slide[:format] == :image
slide && slide[:format] == :image
end

def clear_slide(slide)
clear_background_image if image?(slide)
print clear_screen
end


Expand Down Expand Up @@ -195,15 +200,10 @@ end
n = 0
deck = ARGV[0]
mtime = nil
image = false
slide = nil

loop do
if image
clear_background_image
image = false
end

print clear_screen
clear_slide(slide)

current_mtime = File.mtime(deck)
if mtime != current_mtime
Expand All @@ -217,7 +217,6 @@ loop do

if image?(slide)
render(slide)
image = true
else
render(slide).each_char do |c|
print c
Expand All @@ -235,7 +234,7 @@ loop do
when '$'
n = $slides.length - 1
when 'q'
print clear_screen
clear_slide(slide)
exit
end
end

0 comments on commit 9936e86

Please sign in to comment.