fn repeatability(key_meaning: Option<KeyMeaning>) -> Repeatability {
    match key_meaning {
        Some(KeyMeaning::Codepoint(0)) => Repeatability::No, // e.g. Shift
        Some(KeyMeaning::Codepoint(_)) => Repeatability::Yes, // A code point.
        // This will need to be extended when more nonprintable keys are introduced.
        Some(KeyMeaning::NonPrintableKey(_)) => Repeatability::Yes, // Tab, Enter, Backspace...
        None => Repeatability::Yes, // Printable with US QWERTY keymap.
    }
}
// Determines whether the given key meaning corresponds to a key that should be repeated.
//
// Roughly, the criterion is: if the key may contribute to text editing, it should be repeatable.
// The decisions taken below are a bit pragmatic, since our specification in the FIDL API is not
// exactly clear on when a key is repeatable.  Instead our rules are implicit in the way the key
// meaning is defined.
//
// To wit, nonzero code points are printable and therefore may repeat.
// NonPrintableKey are, paradoxically, repeatable, since the current examples of keys that are
// nonprintable are empirically repeatable.  Keys that are not repeatable have a zero as the
// codepoint - this is not an API requirement, but stems from the way we currently use it, so we
// may as well make it official.  The decisions may become obsolete as KeyMeaning evolves.
//
// TODO(fxbug.dev/89736): Sort out whether Left, Right, Up, Down etc should be nonprintable keys
// or keys with codepoint zero.
Determines whether the given key meaning corresponds to a key that should be repeated.
Roughly, the criterion is: if the key may contribute to text editing, it should be repeatable.
The decisions taken below are a bit pragmatic, since our specification in the FIDL API is not
exactly clear on when a key is repeatable.  Instead our rules are implicit in the way the key
meaning is defined.

To wit, nonzero code points are printable and therefore may repeat.
NonPrintableKey are, paradoxically, repeatable, since the current examples of keys that are
nonprintable are empirically repeatable.  Keys that are not repeatable have a zero as the
codepoint - this is not an API requirement, but stems from the way we currently use it, so we
may as well make it official.  The decisions may become obsolete as KeyMeaning evolves.


Determines whether the given key meaning corresponds to a key that should be repeated . Roughly the criterion is : if the key may contribute to text editing it should be repeatable . The decisions taken below are a bit pragmatic since our specification in the FIDL API is not exactly clear on when a key is repeatable . Instead our rules are implicit in the way the key meaning is defined . To wit nonzero code points are printable and therefore may repeat . NonPrintableKey are paradoxically repeatable since the current examples of keys that are nonprintable are empirically repeatable . Keys that are not repeatable have a zero as the codepoint - this is not an API requirement but stems from the way we currently use it so we may as well make it official . The decisions may become obsolete as KeyMeaning evolves .
fn repeatability(key_meaning: Option<KeyMeaning>) -> Repeatability {
    match key_meaning {
        Some(KeyMeaning::Codepoint(0)) => Repeatability::No, // e.g. Shift
        Some(KeyMeaning::Codepoint(_)) => Repeatability::Yes, // A code point.
        // This will need to be extended when more nonprintable keys are introduced.
        Some(KeyMeaning::NonPrintableKey(_)) => Repeatability::Yes, // Tab, Enter, Backspace...
        None => Repeatability::Yes, // Printable with US QWERTY keymap.
    }
}
fn repeatability ( key_meaning : Option < KeyMeaning > ) -> Repeatability { match key_meaning { Some ( KeyMeaning :: Codepoint ( 0 ) ) => Repeatability :: No , // e.g. Shift Some ( KeyMeaning :: Codepoint ( _ ) ) => Repeatability :: Yes , // A code point. // This will need to be extended when more nonprintable keys are introduced. Some ( KeyMeaning :: NonPrintableKey ( _ ) ) => Repeatability :: Yes , // Tab, Enter, Backspace... None => Repeatability :: Yes , // Printable with US QWERTY keymap. } }
Determines whether the given key meaning corresponds to a key that should be repeated.
Determines whether the given key meaning corresponds to a key that should be repeated .
key_meaning
Option<KeyMeaning>
key_meaning
Option<KeyMeaning>