mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 08:12:40 +01:00
Disable intraline diff highlighting algorithm for lines which contain UTF-8 text
Summary: This is sort of cheating, but just have this feature disable itself if the input contains multibyte UTF-8 characters. We can clean it up in the future, maybe when we have better utf8 tools. This means that all the algorithms are safe to pass utf8 to, so we can get rid of all the "<?>" silliness. Test Plan: Added a UTF8 character to a line, diffed it out, and got the entire line highlighted as changed. See: https://secure.phabricator.com/file/view/PHID-FILE-70fb54eb3f88dc057ab3/ Reviewers: jungejason, aran, tuomaspelkonen CC: Differential Revision: 514
This commit is contained in:
parent
80da1354da
commit
18e34d06bc
1 changed files with 10 additions and 0 deletions
|
@ -55,6 +55,16 @@ final class ArcanistDiffUtils {
|
|||
);
|
||||
}
|
||||
|
||||
// This algorithm is byte-oriented and thus not safe for UTF-8, so just
|
||||
// mark all the text as changed if either string has multibyte characters
|
||||
// in it. TODO: Fix this so that this algorithm is UTF-8 aware.
|
||||
if (preg_match('/[\x80-\xFF]/', $o.$n)) {
|
||||
return array(
|
||||
array(array(1, strlen($o))),
|
||||
array(array(1, strlen($n))),
|
||||
);
|
||||
}
|
||||
|
||||
$result = self::buildLevenshteinDifferenceString($o, $n);
|
||||
|
||||
do {
|
||||
|
|
Loading…
Reference in a new issue