Find the correct column index in adjust_vertical

This commit is contained in:
Matt Brubeck 2016-04-01 12:36:25 -07:00
parent e17ed2e6b0
commit 29fb3f1150
2 changed files with 17 additions and 1 deletions

View file

@ -301,8 +301,11 @@ impl<T: ClipboardProvider> TextInput<T> {
return;
}
let col = self.lines[self.edit_point.line][..self.edit_point.index].chars().count();
self.edit_point.line = target_line as usize;
self.edit_point.index = min(self.current_line_length(), self.edit_point.index);
self.edit_point.index = len_of_first_n_chars(&self.lines[self.edit_point.line], col);
}
/// Adjust the editing point position by a given number of bytes. If the adjustment