Made the unicode feature optional for inline highlighting
This commit is contained in:
parent
84f9bc35c6
commit
df4be6b493
4 changed files with 22 additions and 2 deletions
|
|
@ -18,7 +18,17 @@ impl<'bufs, 's, T: DiffableStr + ?Sized> MultiLookup<'bufs, 's, T> {
|
|||
let mut seqs = Vec::new();
|
||||
for (string_idx, string) in strings.iter().enumerate() {
|
||||
let mut offset = 0;
|
||||
for word in string.tokenize_unicode_words() {
|
||||
let iter = {
|
||||
#[cfg(feature = "unicode")]
|
||||
{
|
||||
string.tokenize_unicode_words()
|
||||
}
|
||||
#[cfg(not(feature = "unicode"))]
|
||||
{
|
||||
string.tokenize_words()
|
||||
}
|
||||
};
|
||||
for word in iter {
|
||||
seqs.push((word, string_idx, offset));
|
||||
offset += word.len();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -485,6 +485,12 @@ impl<'old, 'new, 'bufs, T: DiffableStr + ?Sized + 'old + 'new> TextDiff<'old, 'n
|
|||
/// level diff on adjacent line replacements. The exact behavior of
|
||||
/// this function with regards to how it detects those inline changes
|
||||
/// is currently not defined and will likely change over time.
|
||||
///
|
||||
/// As of similar 1.2.0 the behavior of this function changes depending on
|
||||
/// if the `unicode` feature is enabled or not. It will prefer unicode word
|
||||
/// splitting over word splitting depending on the feature flag.
|
||||
///
|
||||
/// Requires the `inline` feature.
|
||||
#[cfg(feature = "inline")]
|
||||
pub fn iter_inline_changes<'x, 'slf>(
|
||||
&'slf self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue