-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into long-status
- Loading branch information
Showing
61 changed files
with
2,883 additions
and
1,653 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
use crate::Tendril; | ||
|
||
// todo: should this be grapheme aware? | ||
|
||
pub fn to_pascal_case(text: impl Iterator<Item = char>) -> Tendril { | ||
let mut res = Tendril::new(); | ||
to_pascal_case_with(text, &mut res); | ||
res | ||
} | ||
|
||
pub fn to_pascal_case_with(text: impl Iterator<Item = char>, buf: &mut Tendril) { | ||
let mut at_word_start = true; | ||
for c in text { | ||
// we don't count _ as a word char here so case conversions work well | ||
if !c.is_alphanumeric() { | ||
at_word_start = true; | ||
continue; | ||
} | ||
if at_word_start { | ||
at_word_start = false; | ||
buf.extend(c.to_uppercase()); | ||
} else { | ||
buf.push(c) | ||
} | ||
} | ||
} | ||
|
||
pub fn to_upper_case_with(text: impl Iterator<Item = char>, buf: &mut Tendril) { | ||
for c in text { | ||
for c in c.to_uppercase() { | ||
buf.push(c) | ||
} | ||
} | ||
} | ||
|
||
pub fn to_lower_case_with(text: impl Iterator<Item = char>, buf: &mut Tendril) { | ||
for c in text { | ||
for c in c.to_lowercase() { | ||
buf.push(c) | ||
} | ||
} | ||
} | ||
|
||
pub fn to_camel_case(text: impl Iterator<Item = char>) -> Tendril { | ||
let mut res = Tendril::new(); | ||
to_camel_case_with(text, &mut res); | ||
res | ||
} | ||
pub fn to_camel_case_with(mut text: impl Iterator<Item = char>, buf: &mut Tendril) { | ||
for c in &mut text { | ||
if c.is_alphanumeric() { | ||
buf.extend(c.to_lowercase()) | ||
} | ||
} | ||
let mut at_word_start = false; | ||
for c in text { | ||
// we don't count _ as a word char here so case conversions work well | ||
if !c.is_alphanumeric() { | ||
at_word_start = true; | ||
continue; | ||
} | ||
if at_word_start { | ||
at_word_start = false; | ||
buf.extend(c.to_uppercase()); | ||
} else { | ||
buf.push(c) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
mod active; | ||
mod elaborate; | ||
mod parser; | ||
mod render; | ||
|
||
#[derive(PartialEq, Eq, Hash, Debug, PartialOrd, Ord, Clone, Copy)] | ||
pub struct TabstopIdx(usize); | ||
pub const LAST_TABSTOP_IDX: TabstopIdx = TabstopIdx(usize::MAX); | ||
|
||
pub use active::ActiveSnippet; | ||
pub use elaborate::{Snippet, SnippetElement, Transform}; | ||
pub use render::RenderedSnippet; | ||
pub use render::SnippetRenderCtx; |
Oops, something went wrong.