Changeset 882


Ignore:
Timestamp:
12/28/07 19:52:43 (4 years ago)
Author:
bogdanpasoi@…
Message:

Misc diff fixes.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/common/diff.php

    r880 r882  
    118118function split_string($string, $substring, $op_name) { 
    119119    // sentinel character 
    120     $string .= "#"; 
    121     $substring .= "#"; 
     120    $string .= "\n"; 
     121    $substring .= "\n"; 
    122122    $N = strlen($string); 
    123123    $M = strlen($substring); 
     
    126126    for ($i = 0, $j = -1; $i < $M; ++$i) { 
    127127        for ($prev = $j++; $j < $N && $string[$j] != $substring[$i]; ++$j); 
    128         log_assert($j < $N); 
    129         if ($i == $M-1) { 
    130             --$j; 
    131         } 
     128        log_assert($j < $N && $string[$j] == $substring[$i]); 
    132129        if ($j-$prev-1 > 0) { 
    133130            $result[] = array('type' => $op_name, 'string' => substr($string, $prev+1, $j-$prev-1)); 
    134131        } 
    135         $result[] = array('type' => 'normal', 'string' => $string[$j]); 
     132        if ($i < $M-1) { 
     133            $result[] = array('type' => 'normal', 'string' => $string[$j]); 
     134        } 
    136135    } 
    137136 
  • trunk/www/views/textblock_diff.php

    r881 r882  
    3636                $output = str_replace("\n", '', $output); 
    3737                $output = str_replace("\r", '', $output); 
     38                if ($output == "") { 
     39                    $output = " "; 
     40                } 
    3841                echo $output."\n"; 
    3942            } 
Note: See TracChangeset for help on using the changeset viewer.