Skip to content

Instantly share code, notes, and snippets.

@jgouly
Created April 7, 2011 14:23
Show Gist options
  • Save jgouly/907855 to your computer and use it in GitHub Desktop.
Save jgouly/907855 to your computer and use it in GitHub Desktop.
def go_to_char( char, after = ON_CHAR )
r = @last_row
i = @lines[ r ].index( char, @last_col + 1 )
if i
if after
i += 1
end
return cursor_to r, i, DO_DISPLAY
end
loop do
r += 1
break if r >= @lines.size
i = @lines[ r ].index( char )
if i
if after
i += 1
end
return cursor_to r, i, DO_DISPLAY
end
end
end
def go_to_char( char, after = ON_CHAR )
r = @last_row
i = @lines[ r ].index( char, @last_col + 1 )
if !i
loop do
r += 1
return if r >= @lines.size
i = @lines[ r ].index( char )
end
end
if after
i += 1
end
cursor_to r, i, DO_DISPLAY
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment