From 767096b9bbe091f6fed2a3ff31a4c6cc1131ecea Mon Sep 17 00:00:00 2001 From: FabianLars Date: Thu, 27 Feb 2020 12:13:47 +0100 Subject: disable word selection if is_secure == true --- native/src/widget/text_input.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'native/src') diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index b39c2ee8..68fd7dfb 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -214,14 +214,18 @@ where match self.state.mouse.update(cursor_position) { Interaction::DoubleClick(_) => { - let end = self.state.cursor.end(); - self.state.cursor.select_range( - self.value.previous_start_of_word(end), - self.value.next_end_of_word(end), - ) + if self.is_secure { + self.state.cursor.select_all(&self.value); + } else { + let end = self.state.cursor.end(); + self.state.cursor.select_range( + self.value.previous_start_of_word(end), + self.value.next_end_of_word(end), + ); + } } Interaction::TripleClick(_) => { - self.state.cursor.select_all(&self.value) + self.state.cursor.select_all(&self.value); } Interaction::Click(_) => { if target > 0.0 { -- cgit