diff --git a/bin/tkn b/bin/tkn index d5e1c71..92e896f 100755 --- a/bin/tkn +++ b/bin/tkn @@ -206,13 +206,19 @@ def go_to(n) end def search_for(n) - target = prompt('Search for') - return n if target.length == 0 - - regexp = %r{#{target}} - $slides.each.with_index do |slide, i| - next if image?(slide) - n = i and break if ansi_strip(slide[:content]) =~ regexp + begin + target = prompt('Search for') + return n if target.length == 0 + + regexp = %r{#{target}} + $slides.each.with_index do |slide, i| + next if image?(slide) + n = i and break if ansi_strip(slide[:content]) =~ regexp + end + n + rescue => e + puts e + $stdin.getc end n end