rui
rui copied to clipboard
text_editor panics when up/down arrows are pressed at end of text
When running the following code:
use rui::*;
fn main() {
state(|| "Hello".to_owned(), |handle, _| text_editor(handle)).run()
}
on my mac, if you take the cursor to the end of the text and press up/down arrows, app panics. This is because of this:
// src/views/text_editor.rs:64
let p = self.glyph_rects[self.cursor].center();
which fails to account for when self.cursor == self.glyph_rects.len().
also the find_line() function is acting a little weird; in this example, it thinks that the line is 1 and not 0 (thus, when I press up and if the above error is fixed, it thinks the line is 1 and thus still tries to jump a line up)