feat: do not introduce breaking changes

pull/12043/head
Nikita Revenco 2024-12-20 12:31:07 +00:00
parent e6da544a71
commit f8b9497dbc
4 changed files with 25 additions and 25 deletions

View File

@ -96,11 +96,11 @@ pub fn into_alternate_case(text: impl Iterator<Item = char>, buf: &mut Tendril)
});
}
pub fn into_upper_case(text: impl Iterator<Item = char>, buf: &mut Tendril) {
pub fn into_uppercase(text: impl Iterator<Item = char>, buf: &mut Tendril) {
simple_case_conversion(text, buf, char::to_ascii_uppercase);
}
pub fn into_lower_case(text: impl Iterator<Item = char>, buf: &mut Tendril) {
pub fn into_lowercase(text: impl Iterator<Item = char>, buf: &mut Tendril) {
simple_case_conversion(text, buf, char::to_ascii_lowercase);
}
@ -137,12 +137,12 @@ pub fn to_camel_case(text: impl Iterator<Item = char>) -> Tendril {
to_case(text, into_camel_case)
}
pub fn to_lower_case(text: impl Iterator<Item = char>) -> Tendril {
to_case(text, into_lower_case)
pub fn to_lowercase(text: impl Iterator<Item = char>) -> Tendril {
to_case(text, into_lowercase)
}
pub fn to_upper_case(text: impl Iterator<Item = char>) -> Tendril {
to_case(text, into_upper_case)
pub fn to_uppercase(text: impl Iterator<Item = char>) -> Tendril {
to_case(text, into_uppercase)
}
pub fn to_pascal_case(text: impl Iterator<Item = char>) -> Tendril {
@ -209,7 +209,7 @@ mod tests {
];
for (input, expected) in tests {
assert_eq!(to_lower_case(input.chars()), expected)
assert_eq!(to_lowercase(input.chars()), expected)
}
}
@ -231,7 +231,7 @@ mod tests {
];
for (input, expected) in tests {
assert_eq!(to_upper_case(input.chars()), expected)
assert_eq!(to_uppercase(input.chars()), expected)
}
}

View File

@ -10,8 +10,8 @@ use regex_cursor::engines::meta::Regex;
use regex_cursor::regex_automata::util::syntax::Config as RegexConfig;
use ropey::RopeSlice;
use crate::case_conversion::into_lower_case;
use crate::case_conversion::into_upper_case;
use crate::case_conversion::into_lowercase;
use crate::case_conversion::into_uppercase;
use crate::case_conversion::{into_camel_case, into_pascal_case};
use crate::snippets::parser::{self, CaseChange, FormatItem};
use crate::snippets::{TabstopIdx, LAST_TABSTOP_IDX};
@ -348,8 +348,8 @@ impl Transform {
if let Some(cap) = cap.get_group(i).filter(|i| !i.is_empty()) {
let mut chars = doc.byte_slice(cap.range()).chars();
match change {
CaseChange::Upcase => into_upper_case(chars, &mut buf),
CaseChange::Downcase => into_lower_case(chars, &mut buf),
CaseChange::Upcase => into_uppercase(chars, &mut buf),
CaseChange::Downcase => into_lowercase(chars, &mut buf),
CaseChange::Capitalize => {
let first_char = chars.next().unwrap();
buf.extend(first_char.to_uppercase());

View File

@ -19,8 +19,8 @@ pub use typed::*;
use helix_core::{
case_conversion::{
to_alternate_case, to_camel_case, to_kebab_case, to_lower_case, to_pascal_case,
to_snake_case, to_title_case, to_upper_case,
to_alternate_case, to_camel_case, to_kebab_case, to_lowercase, to_pascal_case,
to_snake_case, to_title_case, to_uppercase,
},
char_idx_at_visual_offset,
chars::char_is_word,
@ -356,9 +356,9 @@ impl MappableCommand {
extend_prev_char, "Extend to previous occurrence of char",
repeat_last_motion, "Repeat last motion",
replace, "Replace with new char",
switch_to_alternate_case, "Switch to aLTERNATE cASE",
switch_to_upper_case, "Switch to UPPERCASE",
switch_to_lower_case, "Switch to lowercase",
switch_case, "Switch to aLTERNATE cASE",
switch_to_uppercase, "Switch to UPPERCASE",
switch_to_lowercase, "Switch to lowercase",
switch_to_pascal_case, "Switch to PascalCase",
switch_to_camel_case, "Switch to camelCase",
switch_to_title_case, "Switch to Title Case",
@ -1795,15 +1795,15 @@ fn switch_to_camel_case(cx: &mut Context) {
switch_case_impl(cx, |chars| to_camel_case(chars))
}
fn switch_to_lower_case(cx: &mut Context) {
switch_case_impl(cx, |chars| to_lower_case(chars))
fn switch_to_lowercase(cx: &mut Context) {
switch_case_impl(cx, |chars| to_lowercase(chars))
}
fn switch_to_upper_case(cx: &mut Context) {
switch_case_impl(cx, |chars| to_upper_case(chars))
fn switch_to_uppercase(cx: &mut Context) {
switch_case_impl(cx, |chars| to_uppercase(chars))
}
fn switch_to_alternate_case(cx: &mut Context) {
fn switch_case(cx: &mut Context) {
switch_case_impl(cx, |chars| to_alternate_case(chars))
}

View File

@ -19,10 +19,10 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
"R" => replace_with_yanked,
"A-." => repeat_last_motion,
"~" => switch_to_alternate_case,
"~" => switch_case,
"`" => { "Case"
"l" => switch_to_lower_case,
"u" => switch_to_upper_case,
"l" => switch_to_lowercase,
"u" => switch_to_uppercase,
"p" => switch_to_pascal_case,
"c" => switch_to_camel_case,
"t" => switch_to_title_case,