From ef987ae2ec2b2fed3e22fda89625483d15d79927 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 5 Dec 2019 03:14:32 +0100 Subject: Remove unnecessary use of `abs` --- native/src/widget/text_input.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'native') diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 764f87cf..122f8973 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -477,7 +477,7 @@ fn find_cursor_position( let prev_width = renderer.measure_value(&prev.to_string(), size); let next_width = renderer.measure_value(&next.to_string(), size); - if (target - next_width).abs() > (target - prev_width).abs() { + if next_width - target > target - prev_width { return start - 1; } else { return start; -- cgit