Created
April 7, 2011 14:23
-
-
Save jgouly/907855 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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