diff options
author | 2020-02-27 12:13:47 +0100 | |
---|---|---|
committer | 2020-02-27 12:13:47 +0100 | |
commit | 767096b9bbe091f6fed2a3ff31a4c6cc1131ecea (patch) | |
tree | 668e2b413020c2aaff958d90d150c6217fa39f4b /native/src/widget | |
parent | 1ad83889be32b1bdb746e751aa620fad85b864b0 (diff) | |
download | iced-767096b9bbe091f6fed2a3ff31a4c6cc1131ecea.tar.gz iced-767096b9bbe091f6fed2a3ff31a4c6cc1131ecea.tar.bz2 iced-767096b9bbe091f6fed2a3ff31a4c6cc1131ecea.zip |
disable word selection if is_secure == true
Diffstat (limited to 'native/src/widget')
-rw-r--r-- | native/src/widget/text_input.rs | 16 |
1 files changed, 10 insertions, 6 deletions
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 { |