mirror of https://github.com/helix-editor/helix
fix: use char::to_{lower_uppercase} instead of their ascii variants
parent
917e8057dc
commit
90884f0588
|
@ -135,11 +135,11 @@ pub fn into_alternate_case(chars: impl Iterator<Item = char>, buf: &mut Tendril)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_uppercase(chars: impl Iterator<Item = char>, buf: &mut Tendril) {
|
pub fn into_uppercase(chars: impl Iterator<Item = char>, buf: &mut Tendril) {
|
||||||
*buf = chars.map(|ch| char::to_ascii_uppercase(&ch)).collect();
|
*buf = chars.flat_map(char::to_uppercase).collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_lowercase(chars: impl Iterator<Item = char>, buf: &mut Tendril) {
|
pub fn into_lowercase(chars: impl Iterator<Item = char>, buf: &mut Tendril) {
|
||||||
*buf = chars.map(|ch| char::to_ascii_lowercase(&ch)).collect();
|
*buf = chars.flat_map(char::to_lowercase).collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn into_kebab_case(chars: impl Iterator<Item = char>, buf: &mut Tendril) {
|
pub fn into_kebab_case(chars: impl Iterator<Item = char>, buf: &mut Tendril) {
|
||||||
|
|
|
@ -70,7 +70,6 @@ use crate::{
|
||||||
|
|
||||||
use crate::job::{self, Jobs};
|
use crate::job::{self, Jobs};
|
||||||
use std::{
|
use std::{
|
||||||
char::{ToLowercase, ToUppercase},
|
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
error::Error,
|
error::Error,
|
||||||
|
@ -1739,23 +1738,6 @@ where
|
||||||
exit_select_mode(cx);
|
exit_select_mode(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn switch_case(cx: &mut Context) {
|
|
||||||
switch_case_impl(cx, |string| {
|
|
||||||
string
|
|
||||||
.chars()
|
|
||||||
.flat_map(|ch| {
|
|
||||||
if ch.is_lowercase() {
|
|
||||||
CaseSwitcher::Upper(ch.to_uppercase())
|
|
||||||
} else if ch.is_uppercase() {
|
|
||||||
CaseSwitcher::Lower(ch.to_lowercase())
|
|
||||||
} else {
|
|
||||||
CaseSwitcher::Keep(Some(ch))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn switch_to_pascal_case(cx: &mut Context) {
|
fn switch_to_pascal_case(cx: &mut Context) {
|
||||||
switch_case_impl(cx, |chars| to_pascal_case(chars))
|
switch_case_impl(cx, |chars| to_pascal_case(chars))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue