mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
display input caret for textarea. fixes #7758
This commit is contained in:
parent
50ec235384
commit
80e8a674e2
6 changed files with 67 additions and 21 deletions
|
@ -455,4 +455,14 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
self.edit_point.line = min(self.edit_point.line, self.lines.len() - 1);
|
||||
self.edit_point.index = min(self.edit_point.index, self.current_line_length());
|
||||
}
|
||||
|
||||
pub fn get_absolute_insertion_point(&self) -> usize {
|
||||
self.lines.iter().enumerate().fold(0, |acc, (i, val)| {
|
||||
if i < self.edit_point.line {
|
||||
acc + val.len() + 1 // +1 for the \n
|
||||
} else {
|
||||
acc
|
||||
}
|
||||
}) + self.edit_point.index
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue