mirror of https://github.com/helix-editor/helix
feat: do not introduce breaking changes
parent
e6da544a71
commit
f8b9497dbc
|
@ -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);
|
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);
|
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)
|
to_case(text, into_camel_case)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_lower_case(text: impl Iterator<Item = char>) -> Tendril {
|
pub fn to_lowercase(text: impl Iterator<Item = char>) -> Tendril {
|
||||||
to_case(text, into_lower_case)
|
to_case(text, into_lowercase)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_upper_case(text: impl Iterator<Item = char>) -> Tendril {
|
pub fn to_uppercase(text: impl Iterator<Item = char>) -> Tendril {
|
||||||
to_case(text, into_upper_case)
|
to_case(text, into_uppercase)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_pascal_case(text: impl Iterator<Item = char>) -> Tendril {
|
pub fn to_pascal_case(text: impl Iterator<Item = char>) -> Tendril {
|
||||||
|
@ -209,7 +209,7 @@ mod tests {
|
||||||
];
|
];
|
||||||
|
|
||||||
for (input, expected) in 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 {
|
for (input, expected) in tests {
|
||||||
assert_eq!(to_upper_case(input.chars()), expected)
|
assert_eq!(to_uppercase(input.chars()), expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ use regex_cursor::engines::meta::Regex;
|
||||||
use regex_cursor::regex_automata::util::syntax::Config as RegexConfig;
|
use regex_cursor::regex_automata::util::syntax::Config as RegexConfig;
|
||||||
use ropey::RopeSlice;
|
use ropey::RopeSlice;
|
||||||
|
|
||||||
use crate::case_conversion::into_lower_case;
|
use crate::case_conversion::into_lowercase;
|
||||||
use crate::case_conversion::into_upper_case;
|
use crate::case_conversion::into_uppercase;
|
||||||
use crate::case_conversion::{into_camel_case, into_pascal_case};
|
use crate::case_conversion::{into_camel_case, into_pascal_case};
|
||||||
use crate::snippets::parser::{self, CaseChange, FormatItem};
|
use crate::snippets::parser::{self, CaseChange, FormatItem};
|
||||||
use crate::snippets::{TabstopIdx, LAST_TABSTOP_IDX};
|
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()) {
|
if let Some(cap) = cap.get_group(i).filter(|i| !i.is_empty()) {
|
||||||
let mut chars = doc.byte_slice(cap.range()).chars();
|
let mut chars = doc.byte_slice(cap.range()).chars();
|
||||||
match change {
|
match change {
|
||||||
CaseChange::Upcase => into_upper_case(chars, &mut buf),
|
CaseChange::Upcase => into_uppercase(chars, &mut buf),
|
||||||
CaseChange::Downcase => into_lower_case(chars, &mut buf),
|
CaseChange::Downcase => into_lowercase(chars, &mut buf),
|
||||||
CaseChange::Capitalize => {
|
CaseChange::Capitalize => {
|
||||||
let first_char = chars.next().unwrap();
|
let first_char = chars.next().unwrap();
|
||||||
buf.extend(first_char.to_uppercase());
|
buf.extend(first_char.to_uppercase());
|
||||||
|
|
|
@ -19,8 +19,8 @@ pub use typed::*;
|
||||||
|
|
||||||
use helix_core::{
|
use helix_core::{
|
||||||
case_conversion::{
|
case_conversion::{
|
||||||
to_alternate_case, to_camel_case, to_kebab_case, to_lower_case, to_pascal_case,
|
to_alternate_case, to_camel_case, to_kebab_case, to_lowercase, to_pascal_case,
|
||||||
to_snake_case, to_title_case, to_upper_case,
|
to_snake_case, to_title_case, to_uppercase,
|
||||||
},
|
},
|
||||||
char_idx_at_visual_offset,
|
char_idx_at_visual_offset,
|
||||||
chars::char_is_word,
|
chars::char_is_word,
|
||||||
|
@ -356,9 +356,9 @@ impl MappableCommand {
|
||||||
extend_prev_char, "Extend to previous occurrence of char",
|
extend_prev_char, "Extend to previous occurrence of char",
|
||||||
repeat_last_motion, "Repeat last motion",
|
repeat_last_motion, "Repeat last motion",
|
||||||
replace, "Replace with new char",
|
replace, "Replace with new char",
|
||||||
switch_to_alternate_case, "Switch to aLTERNATE cASE",
|
switch_case, "Switch to aLTERNATE cASE",
|
||||||
switch_to_upper_case, "Switch to UPPERCASE",
|
switch_to_uppercase, "Switch to UPPERCASE",
|
||||||
switch_to_lower_case, "Switch to lowercase",
|
switch_to_lowercase, "Switch to lowercase",
|
||||||
switch_to_pascal_case, "Switch to PascalCase",
|
switch_to_pascal_case, "Switch to PascalCase",
|
||||||
switch_to_camel_case, "Switch to camelCase",
|
switch_to_camel_case, "Switch to camelCase",
|
||||||
switch_to_title_case, "Switch to Title Case",
|
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))
|
switch_case_impl(cx, |chars| to_camel_case(chars))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn switch_to_lower_case(cx: &mut Context) {
|
fn switch_to_lowercase(cx: &mut Context) {
|
||||||
switch_case_impl(cx, |chars| to_lower_case(chars))
|
switch_case_impl(cx, |chars| to_lowercase(chars))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn switch_to_upper_case(cx: &mut Context) {
|
fn switch_to_uppercase(cx: &mut Context) {
|
||||||
switch_case_impl(cx, |chars| to_upper_case(chars))
|
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))
|
switch_case_impl(cx, |chars| to_alternate_case(chars))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ pub fn default() -> HashMap<Mode, KeyTrie> {
|
||||||
"R" => replace_with_yanked,
|
"R" => replace_with_yanked,
|
||||||
"A-." => repeat_last_motion,
|
"A-." => repeat_last_motion,
|
||||||
|
|
||||||
"~" => switch_to_alternate_case,
|
"~" => switch_case,
|
||||||
"`" => { "Case"
|
"`" => { "Case"
|
||||||
"l" => switch_to_lower_case,
|
"l" => switch_to_lowercase,
|
||||||
"u" => switch_to_upper_case,
|
"u" => switch_to_uppercase,
|
||||||
"p" => switch_to_pascal_case,
|
"p" => switch_to_pascal_case,
|
||||||
"c" => switch_to_camel_case,
|
"c" => switch_to_camel_case,
|
||||||
"t" => switch_to_title_case,
|
"t" => switch_to_title_case,
|
||||||
|
|
Loading…
Reference in New Issue