fix(text_input): keyboard shortcuts when keyboard is a different language
Matches what Iced does
This commit is contained in:
parent
2299fba69b
commit
e1738d2ea7
1 changed files with 7 additions and 10 deletions
|
|
@ -1719,13 +1719,10 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
focus.updated_at = Instant::now();
|
focus.updated_at = Instant::now();
|
||||||
LAST_FOCUS_UPDATE.with(|x| x.set(focus.updated_at));
|
LAST_FOCUS_UPDATE.with(|x| x.set(focus.updated_at));
|
||||||
|
|
||||||
// Check if Ctrl+A/C/V/X was pressed.
|
// Check if Ctrl/Command+A/C/V/X was pressed.
|
||||||
if state.keyboard_modifiers == keyboard::Modifiers::COMMAND
|
if state.keyboard_modifiers.command() {
|
||||||
|| state.keyboard_modifiers
|
match key.to_latin(*physical_key) {
|
||||||
== keyboard::Modifiers::COMMAND | keyboard::Modifiers::CAPS_LOCK
|
Some('c') => {
|
||||||
{
|
|
||||||
match key.as_ref() {
|
|
||||||
keyboard::Key::Character("c") | keyboard::Key::Character("C") => {
|
|
||||||
if !is_secure {
|
if !is_secure {
|
||||||
if let Some((start, end)) = state.cursor.selection(value) {
|
if let Some((start, end)) = state.cursor.selection(value) {
|
||||||
clipboard.write(
|
clipboard.write(
|
||||||
|
|
@ -1737,7 +1734,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
}
|
}
|
||||||
// XXX if we want to allow cutting of secure text, we need to
|
// XXX if we want to allow cutting of secure text, we need to
|
||||||
// update the cache and decide which value to cut
|
// update the cache and decide which value to cut
|
||||||
keyboard::Key::Character("x") | keyboard::Key::Character("X") => {
|
Some('x') => {
|
||||||
if !is_secure {
|
if !is_secure {
|
||||||
if let Some((start, end)) = state.cursor.selection(value) {
|
if let Some((start, end)) = state.cursor.selection(value) {
|
||||||
clipboard.write(
|
clipboard.write(
|
||||||
|
|
@ -1756,7 +1753,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
keyboard::Key::Character("v") | keyboard::Key::Character("V") => {
|
Some('v') => {
|
||||||
let content = if let Some(content) = state.is_pasting.take() {
|
let content = if let Some(content) = state.is_pasting.take() {
|
||||||
content
|
content
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1801,7 +1798,7 @@ pub fn update<'a, Message: Clone + 'static>(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboard::Key::Character("a") | keyboard::Key::Character("A") => {
|
Some('a') => {
|
||||||
state.cursor.select_all(value);
|
state.cursor.select_all(value);
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue