mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Replace underscores with spaces when humanizing action names
This commit is contained in:
parent
a9e1f6cb8a
commit
033d000489
@ -269,6 +269,8 @@ fn humanize_action_name(name: &str) -> String {
|
||||
} else {
|
||||
result.push(':');
|
||||
}
|
||||
} else if char == '_' {
|
||||
result.push(' ');
|
||||
} else if char.is_uppercase() {
|
||||
if !result.ends_with(' ') {
|
||||
result.push(' ');
|
||||
@ -300,13 +302,17 @@ mod tests {
|
||||
#[test]
|
||||
fn test_humanize_action_name() {
|
||||
assert_eq!(
|
||||
&humanize_action_name("editor::GoToDefinition"),
|
||||
humanize_action_name("editor::GoToDefinition"),
|
||||
"editor: go to definition"
|
||||
);
|
||||
assert_eq!(
|
||||
&humanize_action_name("editor::Backspace"),
|
||||
humanize_action_name("editor::Backspace"),
|
||||
"editor: backspace"
|
||||
);
|
||||
assert_eq!(
|
||||
humanize_action_name("go_to_line::Deploy"),
|
||||
"go to line: deploy"
|
||||
);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
Loading…
Reference in New Issue
Block a user