OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 | 1039 |
1040 /** | 1040 /** |
1041 * @param {number} value | 1041 * @param {number} value |
1042 * @param {number} symbolsCount | 1042 * @param {number} symbolsCount |
1043 * @return {string} | 1043 * @return {string} |
1044 */ | 1044 */ |
1045 function numberToStringWithSpacesPadding(value, symbolsCount) | 1045 function numberToStringWithSpacesPadding(value, symbolsCount) |
1046 { | 1046 { |
1047 var numberString = value.toString(); | 1047 var numberString = value.toString(); |
1048 var paddingLength = Math.max(0, symbolsCount - numberString.length); | 1048 var paddingLength = Math.max(0, symbolsCount - numberString.length); |
1049 var paddingString = Array(paddingLength).join("\u00a0"); | 1049 var paddingString = Array(paddingLength + 1).join("\u00a0"); |
1050 return paddingString + numberString; | 1050 return paddingString + numberString; |
1051 } | 1051 } |
1052 | 1052 |
1053 /** | 1053 /** |
1054 * @constructor | 1054 * @constructor |
1055 */ | 1055 */ |
1056 function TextDiff() | 1056 function TextDiff() |
1057 { | 1057 { |
1058 this.added = []; | 1058 this.added = []; |
1059 this.removed = []; | 1059 this.removed = []; |
(...skipping 22 matching lines...) Expand all Loading... |
1082 diffData.changed.push(i); | 1082 diffData.changed.push(i); |
1083 else { | 1083 else { |
1084 diffData.added.push(i); | 1084 diffData.added.push(i); |
1085 offset++; | 1085 offset++; |
1086 } | 1086 } |
1087 } else | 1087 } else |
1088 offset = i - right[i].row; | 1088 offset = i - right[i].row; |
1089 } | 1089 } |
1090 return diffData; | 1090 return diffData; |
1091 } | 1091 } |
OLD | NEW |