Update name of function to match other implementation

This commit is contained in:
Brooks Swinnerton 2024-01-28 15:20:50 -05:00
parent c0c0abae56
commit 52f7f2d770
No known key found for this signature in database
GPG Key ID: 72743B7DE552E25A

View File

@ -8,7 +8,7 @@ use crate::{
}; };
pub fn change_case(_: &mut Workspace, _: &ChangeCase, cx: &mut ViewContext<Workspace>) { pub fn change_case(_: &mut Workspace, _: &ChangeCase, cx: &mut ViewContext<Workspace>) {
transform_case(cx, |c| { manipulate_text(cx, |c| {
if c.is_lowercase() { if c.is_lowercase() {
c.to_uppercase().collect::<Vec<char>>() c.to_uppercase().collect::<Vec<char>>()
} else { } else {
@ -22,7 +22,7 @@ pub fn convert_to_upper_case(
_: &ConvertToUpperCase, _: &ConvertToUpperCase,
cx: &mut ViewContext<Workspace>, cx: &mut ViewContext<Workspace>,
) { ) {
transform_case(cx, |c| c.to_uppercase().collect::<Vec<char>>()) manipulate_text(cx, |c| c.to_uppercase().collect::<Vec<char>>())
} }
pub fn convert_to_lower_case( pub fn convert_to_lower_case(
@ -30,10 +30,10 @@ pub fn convert_to_lower_case(
_: &ConvertToLowerCase, _: &ConvertToLowerCase,
cx: &mut ViewContext<Workspace>, cx: &mut ViewContext<Workspace>,
) { ) {
transform_case(cx, |c| c.to_lowercase().collect::<Vec<char>>()) manipulate_text(cx, |c| c.to_lowercase().collect::<Vec<char>>())
} }
fn transform_case<F>(cx: &mut ViewContext<Workspace>, transform: F) fn manipulate_text<F>(cx: &mut ViewContext<Workspace>, transform: F)
where where
F: Fn(char) -> Vec<char> + Copy, F: Fn(char) -> Vec<char> + Copy,
{ {