mirror of https://github.com/helix-editor/helix
refactor: remove 1 layer of nesting
parent
2a1bff5648
commit
fdd1a1c78f
|
@ -35,21 +35,25 @@ pub fn smart_case_conversion(
|
||||||
};
|
};
|
||||||
|
|
||||||
for current in chars.skip_while(|ch| ch.is_whitespace()) {
|
for current in chars.skip_while(|ch| ch.is_whitespace()) {
|
||||||
if current.is_alphanumeric() {
|
if !current.is_alphanumeric() {
|
||||||
|
should_capitalize_current = true;
|
||||||
|
add_separator_if_needed(prev, buf);
|
||||||
|
prev = Some(current);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if has_camel_transition(prev, current) {
|
if has_camel_transition(prev, current) {
|
||||||
add_separator_if_needed(prev, buf);
|
add_separator_if_needed(prev, buf);
|
||||||
should_capitalize_current = true;
|
should_capitalize_current = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if should_capitalize_current {
|
if should_capitalize_current {
|
||||||
buf.push(current.to_ascii_uppercase());
|
buf.push(current.to_ascii_uppercase());
|
||||||
should_capitalize_current = false;
|
should_capitalize_current = false;
|
||||||
} else {
|
} else {
|
||||||
buf.push(current.to_ascii_lowercase());
|
buf.push(current.to_ascii_lowercase());
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
should_capitalize_current = true;
|
|
||||||
add_separator_if_needed(prev, buf);
|
|
||||||
}
|
|
||||||
prev = Some(current);
|
prev = Some(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue