Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid duplicated keymaps #981

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion rust/agama-locale-data/src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl FromStr for KeymapId {

fn from_str(s: &str) -> Result<Self, Self::Err> {
let re = KEYMAP_ID_REGEX
.get_or_init(|| Regex::new(r"(\w+)((\((?<var1>\w+)\)|-(?<var2>\w+)))?").unwrap());
.get_or_init(|| Regex::new(r"([\w.]+)((\((?<var1>.+)\)|-(?<var2>.+)))?").unwrap());

if let Some(parts) = re.captures(s) {
let mut variant = None;
Expand Down Expand Up @@ -153,5 +153,23 @@ mod test {
},
keymap_id2
);

let keymap_id3 = KeymapId::from_str("pt-nativo-us").unwrap();
assert_eq!(
KeymapId {
layout: "pt".to_string(),
variant: Some("nativo-us".to_string())
},
keymap_id3
);

let keymap_id4 = KeymapId::from_str("lt.std").unwrap();
assert_eq!(
KeymapId {
layout: "lt.std".to_string(),
variant: None
},
keymap_id4
);
}
}
6 changes: 6 additions & 0 deletions rust/package/agama-cli.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Jan 8 17:02:40 UTC 2024 - José Iván López González <[email protected]>

- Fix the list of keymaps to avoid duplicated values
(gh#openSUSE/agama#981).

-------------------------------------------------------------------
Thu Dec 21 14:23:33 UTC 2023 - Imobach Gonzalez Sosa <[email protected]>

Expand Down