| 1 |
Description: Make the files visible when one of them is not a text file. |
| 2 |
Author: Innocent De Marchi |
| 3 |
Last-Update: 2017-12-22 |
| 4 |
|
| 5 |
--- a/DiffView.cxx |
| 6 |
+++ b/DiffView.cxx |
| 7 |
@@ -1298,10 +1298,39 @@ |
| 8 |
|
| 9 |
if (directories_) |
| 10 |
pfp.close(); |
| 11 |
|
| 12 |
+ else if (fplinenum <= 1) |
| 13 |
{ |
| 14 |
|
| 15 |
|
| 16 |
+ CPtProcess procFile1, procFile2; |
| 17 |
+ procFile1.fopen(file1, "r"); |
| 18 |
+ procFile2.fopen(file2, "r"); |
| 19 |
+ if (procFile1.is_open() && procFile2.is_open() ) |
| 20 |
+ { |
| 21 |
+ char lineFile1[10240],lineFile2[10240]; |
| 22 |
+ int fileNumber; |
| 23 |
+ while ( (procFile1.get_line(lineFile1, sizeof(lineFile1)) != NULL) ) |
| 24 |
+ { |
| 25 |
+ fileNumber ++; |
| 26 |
+ procFile2.get_line(lineFile2, sizeof(lineFile2)); |
| 27 |
+ add_line(lineFile1,lineFile2,false, fileNumber); |
| 28 |
+ lineFile1[0] = 0; |
| 29 |
+ lineFile2[0] = 0; |
| 30 |
+ } |
| 31 |
+ while ( (procFile2.get_line(lineFile2, sizeof(lineFile2)) != NULL) ) |
| 32 |
+ { |
| 33 |
+ fileNumber ++; |
| 34 |
+ add_line(NULL,lineFile2,false, fileNumber); |
| 35 |
+ lineFile1[0] = 0; |
| 36 |
+ lineFile2[0] = 0; |
| 37 |
+ } |
| 38 |
+ } |
| 39 |
+ if (procFile1.is_open()) |
| 40 |
+ procFile1.close(); |
| 41 |
+ if (procFile2.is_open()) |
| 42 |
+ procFile2.close(); |
| 43 |
+ //else |
| 44 |
+ //{ |
| 45 |
+ // while (pfp.get_line(line, sizeof(line)) != NULL) |
| 46 |
+ // add_line(line, line, false); |
| 47 |
|
| 48 |
pfp.close(); |
| 49 |
} |