You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to do a caseless insensitive compare with diffChars? And in the result use either the case from oldStr or newStr when it comes to matches?
Right now I'm, thinking of lowercasing both oldStr & newStr before calling diffChars. Then when iterating on the output: find the original string (not lowecased) in the user input for the matches.
But this could probably result in unpredictable outcome when certain matches occur multiple times with different case.
Other approach could be to modify the plugin, and lowercase on the point where the comparing is done wothout modifying the case of what's returned. But the code looks pretty complex, but I will give it a try.
The text was updated successfully, but these errors were encountered:
The code is of the plugin is not that complex. I made a custom extend of the base.js, more or less the same as the character.js. Then overwrite the 'equals' function with a lowercase compare, so it's very simple.
(I have some ideas on ways it might make sense to tweak that option, both for consistency with ignoreWhitespace and also to allow the user to get EITHER the old or new text from each change object, but those are already the topic of #219, so I figure I can still go ahead and close this.)
Is there a way to do a caseless insensitive compare with diffChars? And in the result use either the case from oldStr or newStr when it comes to matches?
Right now I'm, thinking of lowercasing both oldStr & newStr before calling diffChars. Then when iterating on the output: find the original string (not lowecased) in the user input for the matches.
But this could probably result in unpredictable outcome when certain matches occur multiple times with different case.
Other approach could be to modify the plugin, and lowercase on the point where the comparing is done wothout modifying the case of what's returned. But the code looks pretty complex, but I will give it a try.
The text was updated successfully, but these errors were encountered: