aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/textinput.rs
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@limpet.net>2016-04-01 12:36:25 -0700
committerMatt Brubeck <mbrubeck@limpet.net>2016-04-01 14:00:50 -0700
commit29fb3f11502e1d69ec1f01e5da87abf212a16264 (patch)
treedec7771c9a2a8c2d2b8d7251137c8f42fce5668b /components/script/textinput.rs
parente17ed2e6b0572fd201c126dbe38ea949ca226fe8 (diff)
downloadservo-29fb3f11502e1d69ec1f01e5da87abf212a16264.tar.gz
servo-29fb3f11502e1d69ec1f01e5da87abf212a16264.zip
Find the correct column index in adjust_vertical
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r--components/script/textinput.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs
index 1f0cb0c53d8..4992cffb3d4 100644
--- a/components/script/textinput.rs
+++ b/components/script/textinput.rs
@@ -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