summaryrefslogtreecommitdiffstats
path: root/doc/en/index.docbook
blob: 652a8cd0ab3028fd9047e9b825295c80ea29b437 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
  <!ENTITY kdiff3 "<application>KDiff3</application>">
  <!ENTITY kappname "&kdiff3;">
  <!ENTITY package "extragear-utils">
  <!ENTITY % addindex "IGNORE">
  <!ENTITY % English "INCLUDE">
]>

<book lang="&language;">

<!-- This header contains all of the meta-information for the document such
as Authors, publish date, the abstract, and Keywords -->

<bookinfo>
<title>The &kdiff3; Handbook</title>

<authorgroup>
<author>
<!--<personname>-->
<firstname>Joachim</firstname>
<surname>Eibl</surname>
<!--</personname>-->
<affiliation><address>
   <email>joachim.eibl at gmx.de</email>
</address></affiliation>
</author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>

<copyright>
<year>2002-2007</year>
<holder>Joachim Eibl</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice.  Read the explanation in fdl-notice.docbook
     and in the FDL itself on how to use it. -->
<legalnotice>&FDLNotice;</legalnotice>

<!-- Date and version information of the documentation
Don't forget to include this last date and this last revision number, we
need them for translation coordination !
Please respect the format of the date (YYYY-MM-DD) and of the version
(V.MM.LL), it could be used by automation scripts.
Do NOT change these in the translation. -->

<date>2007-31-03</date>
<releaseinfo>0.9.92</releaseinfo>


<abstract>
<para>
   &kdiff3; is a file and directory diff and merge tool which
<itemizedlist>
<listitem><para>compares and merges two or three text input files or directories,</para></listitem>
<listitem><para>shows the differences line by line and character by character(!),</para></listitem>
<listitem><para>provides an automatic merge-facility,</para></listitem>
<listitem><para>has an editor for comfortable solving of merge-conflicts,</para></listitem>
<listitem><para>provides networktransparency via TDEIO,</para></listitem>
<listitem><para>has options to highlight or hide changes in white-space or comments,</para></listitem>
<listitem><para>supports Unicode, UTF-8 and other file encodings,</para></listitem>
<listitem><para>prints differences,</para></listitem>
<listitem><para>supports version control keyword and history merging.</para></listitem>
</itemizedlist>
</para><para>
   This document describes &kdiff3;-version 0.9.92.
</para>
</abstract>

<!-- This is a set of Keywords for indexing by search engines.
Please at least include KDE, the KDE package it is in, the name
 of your application, and a few relevant keywords. -->

<keywordset>
<keyword>KDE</keyword>
<keyword>kdeextragear</keyword>
<keyword>kdiff3</keyword>
<keyword>diff</keyword>
<keyword>merge</keyword>
<keyword>CVS</keyword>
<keyword>triplediff</keyword>
<keyword>compare</keyword>
<keyword>files</keyword>
<keyword>directories</keyword>
<keyword>version control</keyword>
<keyword>three-way-merge</keyword>
<keyword>in-line-differences</keyword>
<keyword>synchronise</keyword>
<keyword>kpart</keyword>
<keyword>tdeio</keyword>
<keyword>networktransparent</keyword>
<keyword>editor</keyword>
<keyword>white space</keyword>
<keyword>comments</keyword>
</keywordset>

</bookinfo>

<chapter id="introduction"><title>Introduction</title>
<sect1 id="why"><title>Yet Another Diff Frontend?</title>
<para>
Several graphical diff tools exist. Why choose &kdiff3;? Let me say, why I wrote it.
</para><para>
&kdiff3; started because I had to do a difficult merge. Merging is necessary when several
people work on the same files in a project. A merge can be somewhat automated, when the
merge-tool not only has the new modified files (called "branches"), but also the original file
(called "base"). The merge tool will automatically choose any modification that was only
done in one branch. When several contributors change the same lines, then the merge tool
detects a conflict which must be solved manually.
</para><para>
The merge then was difficult because one contributor had changed many things and corrected
the indentation in many places. Another contributor also had changed much text in the same file,
which resulted in several merge conflicts.
</para><para>
The tool I used then, only showed the changed lines, but not what had changed within these
lines. And there was no information about where only the indentation was changed. The merge
was a little nightmare.
</para><para>
So this was the start. The first version could show differences within a line and showed white space differences.
Later many other features were added to increase the usefulness.
</para><para>
For example if you want to compare some text quickly, then you can copy it to the clipboard and
paste it into either diff window.
</para><para>
A feature that required a big effort was the directory comparison and merge facility, which turned
the program almost into a full file browser.
</para><para>
I hope &kdiff3; works for you too. Have fun!
</para><para>
Joachim Eibl (2003)
</para>
</sect1>

<sect1 id="screenshots"><title>Screenshots and Features</title>
<para>This screenshot shows the difference between two text files</para>
<para>(Using an early version of &kdiff3;):</para>
<screenshot><mediaobject>
   <imageobject><imagedata fileref="screenshot_diff.png" format="PNG"/></imageobject>
</mediaobject></screenshot>

<para>
   3-way-merging is fully supported. This is useful if two people change code independently.
   The original file (the base) is used to help &kdiff3; to automatically select the correct
   changes.
   The merge-editor below the diff-windows allows you to solve conflicts, while showing you the output you will get.
   You can even edit the output.
   This screenshot shows three input files being merged:
</para><para>
<screenshot><mediaobject>
   <imageobject><imagedata fileref="screenshot_merge.png" format="PNG"/></imageobject>
</mediaobject></screenshot>
</para>

<para id="dirmergebigscreenshot">&kdiff3; also helps you to compare and merge complete directories.
This screenshot shows &kdiff3; during a directory merge:
</para><para>
<screenshot><mediaobject>
   <imageobject><imagedata fileref="dirmergebig.png" format="PNG"/></imageobject>
</mediaobject></screenshot>
</para>
</sect1>

<sect1 id="features"><title>More Features</title>
<sect2><title> Line-By-Line And Char-By-Char Diff-Viewer</title>
<para>By using the possiblities of a graphical color display &kdiff3; shows
   exactly what the difference is. When you have to do many code-reviews, you will like this.
</para>
<screenshot><mediaobject>
   <imageobject><imagedata fileref="letter_by_letter.png" format="PNG"/></imageobject>
</mediaobject></screenshot>
</sect2>

<sect2><title> See White-Space Differences At One Glance</title>
<para>Spaces and tabs that differ appear visibly. When lines differ only
   in  the  amount of white space this can be seen at one look in the summary
   column on the left side. (No more worries when people change the indentation.)
</para>
<screenshot><mediaobject>
   <imageobject><imagedata fileref="white_space.png" format="PNG"/></imageobject>
</mediaobject></screenshot>
</sect2>

<sect2><title> Triple-Diff</title>
<para> Analyze three files and see where they differ.
</para><para>
   The left/middle/right windows are named A/B/C and have the blue/green/magenta
   color respectively.
</para><para>
   If one file is the same and one file is different on a line then the
   color   shows which file is different. The red color means that both other
   files  are different.
</para>
<screenshot><mediaobject>
   <imageobject><imagedata fileref="triple_diff.png" format="PNG"/></imageobject>
</mediaobject></screenshot>
</sect2>

<sect2><title> Comfortable Merge Of Two Or Three Input Files</title>
<para> &kdiff3; can be used to merge two or three input files and automatically
   merges as much as possible. The result is presented in an editable window
   where most conflicts can be solved with a single mouseclick: Select the
   buttons  A/B/C from the button-bar to select the source that should be used.
   You can  also select more than one source. Since this output window is an
   editor even  conflicts which need further corrections can be solved here without
   requiring  another tool.
</para>
</sect2>

<sect2><title>And ...</title>
<itemizedlist>
   <listitem><para>Fast navigation via buttons.</para></listitem>
   <listitem><para>A mouse-click into a summary column sync's all windows to show the same position.</para></listitem>
   <listitem><para>Select and copy from any window and paste into the merge result window.</para></listitem>
   <listitem><para>Overview column that shows where the changes and conflicts are.</para></listitem>
   <listitem><para>The colors are adjustable to your specific preferences.</para></listitem>
   <listitem><para>Adjustable Tab size.</para></listitem>
   <listitem><para>Option to insert spaces instead of tabs.</para></listitem>
   <listitem><para>Open files comfortably via dialog or specify files on the command line.</para></listitem>
   <listitem><para>Search for strings in all text windows. Find (Ctrl-F) and Find Next (F3)</para></listitem>
   <listitem><para>Show the line numbers for each line. </para></listitem>
   <listitem><para>Paste clipboard or drag text into a diff input window.</para></listitem>
   <listitem><para>Networktransparency via TDEIO.</para></listitem>
   <listitem><para>Can be used as diff-viewer in KDevelop 3.</para></listitem>
   <listitem><para>Word-wrap for long lines.</para></listitem>
   <listitem><para>Support for Unicode, UTF-8 and other codecs.</para></listitem>
   <listitem><para>Support for right to left languages.</para></listitem>
   <listitem><para>...</para></listitem>
</itemizedlist>
</sect2>
</sect1>
</chapter>

<chapter id="documentation"><title>File Comparison And Merge</title>

<sect1 id="commandline"><title>Command-Line Options</title>

<sect2><title>Comparing 2 files: </title>
<screen>
   <command>kdiff3</command> <replaceable>file1 file2</replaceable>
</screen>
</sect2>

<sect2><title>Merging 2 files: </title>
<screen>
   <command>kdiff3</command> <replaceable>file1 file2</replaceable> -m
   <command>kdiff3</command> <replaceable>file1 file2</replaceable> -o <replaceable>outputfile</replaceable>
</screen>
</sect2>

<sect2><title>Comparing 3 files: </title>
<screen>
   <command>kdiff3</command> <replaceable>file1 file2 file3</replaceable>
</screen>
</sect2>

<sect2><title>Merging 3 files: </title>
<screen>
   <command>kdiff3</command> <replaceable>file1 file2 file3</replaceable> -m
   <command>kdiff3</command> <replaceable>file1 file2 file3</replaceable> -o <replaceable>outputfile</replaceable>
</screen>
<para>
   Note that <replaceable>file1</replaceable> will be treated as
   base of <replaceable>file2</replaceable> and
   <replaceable>file3</replaceable>.
</para>
</sect2>

<sect2><title>Special case: Files with the same name </title>
<para>
If all files have the same name but are in different directories, you can
reduce typework by specifying the filename only for the first file. E.g.:
</para>
<screen>
   <command>kdiff3</command> <replaceable>dir1/filename dir2 dir3</replaceable>
</screen>
</sect2>

<sect2><title>Commandline for starting a directory comparison or merge: </title>
<para>This is very similar, but now it's about directories.</para>
<screen>
   <command>kdiff3</command> <replaceable>dir1 dir2</replaceable>
   <command>kdiff3</command> <replaceable>dir1 dir2</replaceable> -o <replaceable>destdir</replaceable>
   <command>kdiff3</command> <replaceable>dir1 dir2 dir3</replaceable>
   <command>kdiff3</command> <replaceable>dir1 dir2 dir3</replaceable> -o <replaceable>destdir</replaceable>
</screen>
<para>For directory comparison and merge you can continue to read <link linkend="dirmerge">here</link>.</para>
</sect2>

<sect2><title>Other command line options</title>
<para>To see all available command line options type</para>
<screen>
<command>kdiff3</command> --help
</screen>
<para>Example output:</para>
<screen>
Options:
  -m, --merge               Merge the input.
  -b, --base file           Explicit base file. For compatibility with certain tools.
  -o, --output file         Output file. Implies -m. E.g.: -o newfile.txt
  --out file                Output file, again. (For compatibility with certain tools.)
  --auto                    No GUI if all conflicts are auto-solvable. (Needs -o file)
  --qall                    Don't solve conflicts automatically. (For compatibility...)
  --L1 alias1               Visible name replacement for input file 1 (base).
  --L2 alias2               Visible name replacement for input file 2.
  --L3 alias3               Visible name replacement for input file 3.
  -L, --fname alias         Alternative visible name replacement. Supply this once for every input.
  --cs string               Override a config setting. Use once for every setting. E.g.: --cs "AutoAdvance=1"
  --confighelp              Show list of config settings and current values.
  --config file             Use a different config file.
</screen>
<para>The option <option>--cs</option> allows you to adjust a configuration value that is otherwise only adjustable via the configure dialogs. 
But be aware that when &kdiff3; then terminates the changed value will be stored along with the other settings. 
With <option>--confighelp</option> you can find out the names of the available items and current values.</para>
<para>Via <option>--config</option> you can specify a different config file. When you often use &kdiff3; 
with completely different setups this allows you to easily switch between them.</para>
</sect2>
<sect2><title>Ignorable command line options</title>
<para>Many people want to use &kdiff3; with some version control system. 
But when that version control system calls &kdiff3; using command line parameters that &kdiff3; doesn't recognise, then &kdiff3; terminates with an error.
The integration settings allow to specify command line parameters that should be ignored by &kdiff3;. 
They will appear in the usage help like in this example:</para>
<screen>
  --<replaceable>foo</replaceable>                     Ignored. (User defined.)
</screen>
<variablelist>
  <varlistentry><term><emphasis>Command line options to ignore:</emphasis></term><listitem><para>
     A list of options, separated via semicolon ';'. When one of these options appears on the commandline, 
     then &kdiff3; will ignore it and run without reporting an error. 
     (Default is "u;query;html;abort").</para></listitem></varlistentry>
</variablelist>
<para>When this isn't enough, then it is recommended to write a shell script that does the option translation.</para>
</sect2>

</sect1>

<sect1 id="opendialog"><title>Open-Dialog</title>
<para>
   Since many input files must be selectable, the program has a special open dialog:
</para>
<screenshot><mediaobject>
<imageobject><imagedata fileref="open_dialog.png" format="PNG"/></imageobject>
</mediaobject></screenshot>
<para>
   The open dialog allows to edit the filenames by hand, selecting a file
   via  the file-browser ("File...") or allows to choose recent files from
   the drop-down lists. If you open the dialog again, then the current names
   still remain there. The third input file is not required. If the
   entry   for "C" remains empty, then only a two file diff analysis will be
   done.
</para><para>
   You can also select a directory via "Dir...". If for A a directory is specified
   then a directory-comparison/merge starts. If A specifies a file but B, C or
   the output specify a directory, then &kdiff3; uses the filename from A in the
   specified directories.
</para><para>
   If "Merge" is selected, then the "Output"-line becomes editable. But it
   is not required to specify the output filename immediately. You can also
   postpone this until saving.
</para><para>
   The "Configure..."-button opens the options-dialog, so that you can set
   the options before running the analysis.
</para>
</sect1>

<sect1 id="pasteinput"><title>Paste and Drop Input</title>
<para>
   Sometimes you want to compare parts of a text that is not an own file. &kdiff3; also
   allows you to paste text from the clipboard into the diff input window that has the focus.
   The diff analysis happens immediately then.
   In the open dialog you need not specify files then, but just close it via "Cancel".
</para><para>
   You can also use drag and drop: Drag a file from a file manager
   or selected text from an editor and drop it onto a diff input window.
</para><para>
   What's the idea? Sometimes a file contains two similar functions, but checking how similar
   they really are is a big effort if you first must create two files and then load them. Now
   you can simply copy, paste and compare the relevant sections.
</para><para>
   Note: Currently you cannot drag anything from &kdiff3;. Only dropping in the diff input
   is supported.
</para><para>
   Warning: Some editors still interpret the drag and drop into another program like cut
   (instead of copy) and paste. Your original data might be lost then.
</para>
</sect1>

<sect1 id="interpretinginformation"><title>Comparing Files And Interpreting The Information In The Input Windows</title>
<screenshot><mediaobject>
<imageobject><imagedata fileref="screenshot_diff.png" format="PNG"/></imageobject>
</mediaobject></screenshot>
<sect2><title>Info Line</title><para>
   At the top of each text window is its "info line". The info lines of
   the input windows contain a letter "A", "B" or "C", the editable filename,
   a button for browsing, and the line number of the first visible line in the window. 
   (Note that window "C" is  optional.) Each info line appears in a different color.
</para><para>
   When you selected another file via browsing or finished editing the filename here 
   by pressing enter, the new file will be loaded and 
   compared with the already loaded file(s).
</para></sect2><sect2><title>Coloring</title><para>
   The three input windows are assigned the letters "A", "B" and "C".
   "A"   has  color blue, "B" has green and "C" has magenta. (These are the
   defaults,   but  can be changed in the Settings-Menu.)
</para><para>
   When a difference is detected then the color shows which input file
   differs.   When both other input files differ then the color used to express
   this is   red by default ("Conflict color" in the Settings).
   This colorscheme is especially useful in the case of three input files, which will be
   seen in the next section (<link linkend="merging">Merging</link>).
</para></sect2><sect2><title>Summary Column</title><para>
   Left of each text is the "summary column". If differences occurred on a
   line then the summary column shows the respective color. For a white-space-only
   difference the summary is chequered. For programming languages where white
   space is not so important this is useful to see at one glance if anything
   of importance was modified. (In C/C++ white space is only interesting within
   strings, comments, for the preprocessor, and some only very esoteric situations.)
</para><para>
   The vertical line separating the summary column and the text is interrupted
   if the input file had no lines there. When word-wrap is enabled then this vertical 
   line appears dotted for wrapped lines.
</para></sect2><sect2><title>Overview Column</title><para>
   On the right side a "overview"-column is visible left of the vertical scrollbar.
   It shows the compressed summary column of input "A". All the differences
   and conflicts are visible at one glance. When only two input windows are
   used, then all differences appear red here because every difference is
   also   a conflict. A black rectangle frames the visible part of the inputs.
   For  very long input files, when the number of input lines is bigger than
   the height of the overview column in pixels, then several input lines share
   one overview line. A conflict then has top priority over simple differences,
   which have priority over no change, so that no difference or conflict is
   lost here.  By clicking into this overview column the corresponding text
   will be shown.
</para></sect2><sect2 id="manualdiffhelp"><title>Manually Aligning Lines</title><para>
   Sometimes the algorithm places the wrong lines next to each other. Or you want to compare 
   one piece of text with text at a completely different position in the other file.
   For these situations you can manually instruct &kdiff3; to align certain lines. 
   Mark the text for which you want to improve the alignment with the mouse as you would 
   for copy and paste in the first diff view and then choose "Add Manual Diff Alignment" 
   in the "Diffview"-menu (keyboard shortcut "Ctrl-Y") . An orange bar will appear in 
   the summary column next to the chosen text. Repeat this for the second and 
   (if available) third diff view. &kdiff3; will immediately recalculate the differences everytime you do this.
   and will align the chosen lines. Of course some of the previously matching lines in between 
   might not match anymore.
</para><para>
   Currently merging doesn't support the use of manual diff help.
</para></sect2><sect2 id="joinsplitsections"><title>Manually Joining and Splitting Diff Sections</title><para>
   In some cases &kdiff3; will see too many or too few diff sections for merging. In such a 
   case you can join or split existing sections.
</para><para>
   Add new sections by first selecting text in the lines that belong together in either input window (as for copying to the clipboard). 
   Then choose "Split Diff At Selection" in the "Merge" menu.
   Splits will be added above the first line and below the last line of the selected text.
   If you only want to add one section, then select text beginning at another section-split.
</para><para>
   For joining sections in either input window select something in the lines from the sections to join.
   (You can join several sections in one step too.) Then choose "Join selected Diffs" in the "Merge"-menu.
</para></sect2>
</sect1>


<sect1 id="merging"><title>Merging And The Merge Output Editor Window</title>
<screenshot><mediaobject>
<imageobject><imagedata fileref="screenshot_merge.png" format="PNG"/></imageobject>
</mediaobject></screenshot>
<para>
   The merge output editor window (below the diff input windows) also has an info line at the top showing "Output:", the
   filename   and "[Modified]" if you edited something. Usually it will contain
   some text  through the automatic merge facilities, but often it will also
   contain conflicts.
</para><para>
   !!! Saving is disabled until all conflicts are resolved !!! (Use the "Go
   to prev/next unsolved conflicts"-buttons to find the remaining conflicts.)
</para><para>
   With only two input files every difference is also a conflict that must
   be solved manually.
</para><para>
   With three input files the first file is treated as base, while the
   second   and third input files contain modifications. When at any line only
   either   input B or input C have changed but not both then the changed source
   will   automatically be selected. Only when B and C have changed on the same
   lines,   then the tool detects a conflict that must be solved manually.
   When B and C are the same, but not the same as A, then C is selected.
</para><sect2><title>The Summary Column</title><para>
   The merge output editor window also has a summary column on the left. It shows the
   letter of the input from which a line was selected or nothing if all three
   sources where equal on a line. For conflicts it shows a questionmark "?"
   and the line shows "&lt;Merge Conflict&gt;", all in red. Because solving
   conflicts  line by line would take very long, the lines are grouped into
   groups that  have the same difference and conflict characteristics.
   But only-white-space-conflicts are separated from non-white-space-conflicts
   in order to ease the merging of files were the indentation changed for many
   lines.
</para></sect2><sect2 id="synchronise_views"><title>Setting The Current Group And Synchronising Merge And Diff View Position</title><para>
   When clicking into  the summary column with the left mouse button in either
   window then the beginning of the group belonging to that line will shown in all windows.
   This group then becomes the "current group". It is highlighted with the
   "Current range (diff) background color" and
   a black bar appears on the left side of the text.
</para></sect2><sect2><title>Choosing Inputs A, B or C For Current Conflict And Editing</title><para>
   The button bar below the menubar contains three input selector buttons 
   containing the letters "A", "B" and "C". Click the input selector 
   button to insert (or remove if already inserted) the lines from the respective source.
   To choose the lines from several inputs click the respective buttons in the
   needed order. For example if you want that the lines from "B" appear before 
   the lines from "A" in the output, first click "B", then "A".
</para><para>
   If you use the auto-advance option 
   (<link linkend="autoadvance">"Automatically go to next unsolved conflict after source selection"</link>),
   you should disable this before choosing lines from several inputs or if you want to
   edit the lines after your choice. Otherwise &kdiff3; will jump to the next
   conflict after choosing the first input.
</para><para>
   It is often helpful directly edit the merge output. 
   The summary column will show "m" for every line that was manually modified. 
   When for instance the differences are aligned in a way that simply choosing 
   the inputs won't be satisfactory, then you can mark the needed text and use 
   normal <link linkend="selections">copy and paste</link> to put it into the merge output.
</para><para>
   Sometimes, when a line is removed either by automatic merge or by editing
   and no other lines remain in that group, then the text &lt;No src line&gt;
   will appear in that line. This is just a placeholder for the group for
   when  you might change your mind and select some source again. This text won't
   appear in the saved file or in any selections you want to copy and paste.
</para><para>
   The text "&lt;Merge Conflict&gt;" will appear in the clipboard if you
   copy and   paste some text containing such a line. But still be careful to
   do so.
</para></sect2><sect2><title>Choosing Input A, B, or C for All Conflicts</title><para>
   The normal merge will start by solving simple conflicts automatically.
   But the "Merge"-menu provides some actions for other common needs.
   If you have to select the same source for most conflicts, then you can
   choose "A", "B" or "C" everywhere, or only for the remaining unsolved
   conflicts, or for unsolved white space conflicts. If you want to decide every
   single delta yourself, you can "Set deltas to conflicts". Or if you want to
   return to the automatic choices of &kdiff3; then select
   "Automatically solve simple conflicts". &kdiff3; then restarts the merge.
   For actions that change your previous modifications &kdiff3; will ask for your
   confirmation before proceeding.
</para><para>
   Note: When choosing either source for unsolved white space conflicts and
   the options "Ignore Numbers" or "Ignore C/C++ Comments" are used then changes in
   numbers or comments will be treated like white space too.

</para></sect2><sect2 id="vcskeywordsmergesupport"><title>Automatic Merge of Version Control Keywords and History (Log)</title><para>
Many version control systems support special keywords in the file. (e.g. "&#36;Date&#36;", 
"&#36;Header&#36;", "&#36;Author&#36;", "&#36;Log&#36;" etc.) During the 
check-in the version control system (VCS) changes these lines. For instance 
"&#36;Date&#36;" will turn into "&#36;Date: 2005/03/22 18:45:01 &#36;". Since this line will 
be different in every version of the file, it would require manual interaction 
during the merge.
</para><para>
&kdiff3; offers automatic merge for these items. For simple lines that match the 
"Auto merge regular expression"-option in all input-files &kdiff3; will choose 
the line from B or - if available - from C. (Additionally it is necessary that the lines 
in question line up in the comparison and the previous line contains no conflict.)
This auto merge can either be run immediately after a merge starts (activate the option 
"Run regular expression auto merge on merge start") or later via the merge 
menu "Run Regular Expression Auto Merge".
</para><para>
Automatic merge for version control history (also called "log") is also supported.
The history automerge can either run immediately when the merge starts by activating the 
option "Merge version control history on merge start" or later via the merge menu 
"Automatically Solve History Conflicts".
</para><para>
Usually the version control history begins with a line containing the keyword "&#36;Log&#36;".
This must be matched by the "History start regular expression"-option.
&kdiff3; detects which subsequent lines are in the history by analysing the leading characters 
that came before the "&#36;Log&#36;"-keyword. If the same "leading comment"-characters also appears in the following
lines, then they are also included in the history.
</para><para>
During each check-in the VCS writes a unique line specifying version-, date- and time-information 
followed by lines with user comments.
These lines form one history-entry. This history section grows with every check-in and the 
most recent entries appear at the top (after the history start line). 
</para><para>
When for parallel development two or more developers check-in a branch of the file then 
the merge history will contain several entries that appear as conflicts during the merge 
of the branches. Since merging these can become very tedious, &kdiff3; offers support with two 
possible strategies: Just insert the history information from both contributors at the top
or sort the history information by a user defined key.
</para><para>
The just-insert-all-entries-method is easier to configure. &kdiff3; just needs a method to
detect, which lines belong to one history entry. Most VCS insert an empty line after each
history entry. If there are no other empty lines, this is a sufficient criterion for &kdiff3;.
Just set an empty "History entry start regular expression". If the empty line criterion 
isn't sufficient, you can specify a regular expression to detect the history entry start.
</para><para>
Note that &kdiff3; will remove duplicate history entrys. If a history entry appeared several times
in the history of a input file, only one entry will remain in the output.
</para><para>
If you want to sort the history, then you have to specify how the sort key should be built.
Use parentheses in the "History entry start regular expression" to group parts of the regular 
expression that should later be used for the sort key.
Then specify the "History entry start sort key order" specifying a comma "," separated list of 
numbers referring to the position of the group in the regular expression.
</para><para>
Because this is not so easy to get right immediately, you are able to test and improve
the regular expressions and key-generation in a dedicated dialog by pressing the 
"Test your regular expressions"-button.
</para><para>Example: Assume a history that looks like this:
<screen>
/**************************************************************************
** HISTORY:    &#36;Log: \toms_merge_main_view\MyApplication\src\complexalgorithm.cpp &#36;
**
**     \main\integration_branch_12   2 Apr 2001 10:45:41   tom
**  Merged branch simon_branch_15.
**
**     \main\henry_bugfix_branch_7\1   30 Mar 2001 19:22:05   henry
**  Improved the speed for subroutine convertToMesh().
**  Fixed crash.
**************************************************************************/
</screen>
The history start line matches the regular expression ".*\&#36;Log.*\&#36;.*". Then follow 
the history entries.
</para><para>
The line with the "&#36;Log&#36;"-keyword begins with two "*" after which follows a space. 
&kdiff3; uses the first non-white-space string as "leading comment" and assumes that
the history ends in the first line without this leading comment. In this example the
last line ends with a string that also starts with two "*", but instead of a space 
character more "*" follow. Hence this line ends the history.
</para><para>
If history sorting isn't required then the history entry start line regular expression
could look like this. (This line is split in two because it wouldn't fit otherwise.)
<screen>
\s*\\main\\\S+\s+[0-9]+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
 [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\s+.*
</screen>
For details about regular expressions please see the
<ulink url="http://doc.trolltech.com/3.3/qregexp.html#details">regular expression documentation by Trolltech</ulink>.
Note that "\s" (with lowercase "s") matches any white space and "\S" (with uppercase "S") matches any non-white-space.
In our example the history entry start contains first the version info with reg. exp. "\\main\\\S+", the date consisting of day "[0-9]+", month "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)" and year "[0-9][0-9][0-9][0-9]", the time "[0-9][0-9]:[0-9][0-9]:[0-9][0-9]" and finally the developers login name ".*".
</para><para>
Note that the "leading comment"-characters (in the example "**") will already be removed by &kdiff3; 
before trying to match, hence the regular expression begins with a match for none or more white-space characters "\s*".
Because comment characters can differ in each file (e.g. C/C++ uses other comment characters than a Perl script)
&kdiff3; takes care of the leading comment characters and you should not specify them in the regular expression.
</para><para>
If you require a sorted history. Then the sortkey must be calculated. For this the 
relevant parts in the regular expression must be grouped by parentheses. 
(The extra parentheses can also stay in if history sorting is disabled.)
<screen>
\s*\\main\\(\S+)\s+([0-9]+) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
 ([0-9][0-9][0-9][0-9]) ([0-9][0-9]:[0-9][0-9]:[0-9][0-9])\s+(.*)
</screen>
The parentheses now contain 1. version info, 2. day, 3. month, 4. year, 5. time, 6. name. 
But if we want to sort by date and time, we need to construct a key with the elements in a different order of appearance:
First the year, followed by month, day, time, version info and name. Hence the sortkey order to specify is "4,3,2,5,1,6".
</para><para>
Because  month names aren't good for sorting ("Apr" would be first) &kdiff3; detects in which order 
the month names were given and uses that number instead ("Apr"->"04"). 
And if a pure number is found it will be transformed to a 4-digit value with leading zeros for sorting.
Finally the resulting sort key for the first history entry start line will be:
<screen>
2001 04 0002 10:45:41 integration_branch_12   tom 
</screen>
</para><para>
For more information also see <link linkend="mergeoptions">Merge Settings</link>.
</para>
</sect2>
</sect1>

<sect1 id="navigation"><title>Navigation And Editing</title>
<para>
   Much navigation will be done with the scroll bars and the mouse but
   you  can also navigate with the keys. If you click into either window then
   you  can use the cursor buttons left, right, up, down, page up, page down,
   home,  end, ctrl-home, ctrl-end as you would in other programs. The overview-column
   next to the vertical scroll bar of the input files can also be used  for
   navigating by clicking into it.
</para><para>
   You can also use the wheel mouse to scroll up and down.
</para><para>
   In the merge output editor you can also use the other keys for editing.
   You can toggle between insert and overwrite mode with the insert key. (Default
   is insert-mode.)
</para><para>
   A left-mouse-button-click into any summary column will synchronise all
   windows to show the beginning of the same group of lines (as explained
   in section <link linkend="synchronise_views">"Setting The Current Group And Synchronising Merge And Diff View Position"</link>).
</para><para>
   The button bar also contains nine navigation buttons with which you can
   jump to the current/first/last difference, to the next/previous difference
   (ctrl-down/ctrl-up), to the next/previous conflict (ctrl-pgdown/ctrl-pgup),
   or to the next/previous unsolved conflict. Note that for &kdiff3; a "conflict"
   that was not automatically solved at the start of the merge stays a "conflict"
   even if it is solved. Hence the necessity to distinguish "unsolved conflicts".
</para>
<sect2 id="autoadvance"><title>Auto-Advance</title>
<para>
   There also is a button "Automatically go to next unsolved conflict after
   source selection" (Auto-Advance). If you enable this, then, when one source
   is selected, &kdiff3; will jump to and select the next unsolved conflict
   automatically. This can help when you always want to choose one source only.
   When you need both sources, or you want to edit after selecting, then you
   probably want to switch this off. Before proceeding to the next unsolved conflict
   &kdiff3; shows you the effect of your choice for a short time. This delay is
   adjustable in the Diff- &amp; Merge-Settings: You can
   specify the "Auto-Advance delay" in milli seconds between 0 and 2000. Hint:
   Tired of many clicks? - Use a small Auto-Advance-delay and the shortcuts
   Ctrl-1/2/3 to select A/B/C for many conflicts.
</para>
</sect2>
</sect1>

<sect1 id="selections"><title>Select, Copy And Paste</title>
<para>
   The input windows don't show a cursor, so selections must be made
   with   the mouse by clicking with the left mouse button at the start, holding
   down   the mousebutton and moving to the end, where you release the mouse
   button   again. You can also select a word by double clicking it. In the merge
   output   editor you can also select via the keyboard by holding the "shift"-button
   and navigation with the cursor keys.
</para><para>
   If the selection exceeds the visible range you can move the mouse over the 
   window borders which causes &kdiff3; to scroll in that direction. 
</para><para>
   For very large selections you can also use the navigation keys while holding down 
   the mouse. E.g. use page up and page down to quickly go to a certain position. At the 
   end position release the mouse button.
</para><para>
   In order to select everything in the current window use menu "Edit"->"Select All" (Ctrl-A).
</para><para>
   To copy to the clipboard you must press the "Copy"-button (Ctrl-C or Ctrl-Insert).
   But there exists an option "Auto Copy Selection". If this is enabled,
   then whatever you select is copied immediately and you don't need to explicitely
   copy. But pay attention when using this because the contents of the clipboard
   might then be destroyed accidentally.
</para><para>
   "Cut" (Ctrl-X or Shift-Delete) copies to the clipboard and deletes the
   selected text.
</para><para>
   "Paste" (Ctrl-V or Shift-Insert) inserts the text in the clipboard at the 
   cursorposition or over the current selection.
   If you paste to either diff input window the contents of the clipboard will 
   be shown in that window and the comparison will restart immediately. This is 
   useful if you want to quickly grab a piece of text from somewhere and 
   compare it with something else without first creating files.
</para>
</sect1>

<sect1 id="saving"><title>Saving</title>
<para>
   Saving will only be allowed, when all conflicts were solved. If the file
   already exists and the "Backup files"-option is enabled then the existing
   file will be renamed with an ".orig"-extension, but if such a file exists
   it will be deleted. When you exit or start another diff-analysis and data
   wasn't saved yet, then &kdiff3; will ask if you want to save, cancel or proceed
   without saving. (&kdiff3; does not catch any signals. So if you "kill" &kdiff3;
   then your data will be lost.)
</para><para>
   Line endings are saved according to the normal method on the underlying
   operating system. For Unices each line ends with an linefeed-character "\n",
   while for Win32-based systems each line ends with a carriage-return + a linefeed
   "\r\n". &kdiff3; does not preserve the line-endings of the input files, which
   also means that you shouldn't use &kdiff3; with binary files.
</para>
</sect1>

<sect1 id="find"><title>Finding Strings</title>
<para>
   You can search for a string in any text-window of &kdiff3;. The "Find ..."-command
   (Ctrl-F) in the Edit-menu opens a dialog that lets you specify the string
   to search for. You can also select the windows which should be searched.
   Searching will always start at the top. Use the "Find Next"-command (F3)
   to proceed to the next occurrence. If you select to search several windows then the first
   window will be searched from top to bottom before the search starts in the next
   window at the top again, etc.
</para>
</sect1>

<sect1 id="printing"><title>Printing</title>
<para>
   &kdiff3; supports printing for textfile differences. The "Print..."-command (Ctrl-P) 
   in the File-menu opens a dialog that allows you to select the printer and to adjust
   other options.
</para><para>
   There are several possibilities to adjust the range. Due to different printing 
   dialogs on different operating systems, the method to achieve certain range selections varies.
</para>
<variablelist>
   <varlistentry><term>All:</term><listitem><para>Print everything.</para></listitem></varlistentry>
   <varlistentry><term>Current:</term><listitem><para>Print a page starting at the first visible line in the window. 
       (On systems without this option this can be achived by specifying page number 10000 for printing.)</para></listitem></varlistentry>
   <varlistentry><term>Selection:</term><listitem><para>
       Before choosing to print select text with the mouse (like for copy and paste) 
       in one of the diff input windows to define the start and end line. If no text 
       in one of the diff input windows was selected, then this won't be an available 
       choice. (On systems without this option this can be achived by specifying page 
       number 9999 for printing.)</para></listitem></varlistentry>
   <varlistentry><term>Range:</term><listitem><para>Specify the first and last page.
       </para></listitem></varlistentry>
</variablelist>
<para>
   Other important options for printing will be taken from the normal options:
</para><itemizedlist>
   <listitem><para>Font, font size</para></listitem>
   <listitem><para>Show line numbers</para></listitem>
   <listitem><para>Word wrap</para></listitem>
   <listitem><para>Colors</para></listitem>
   <listitem><para>etc.</para></listitem>
</itemizedlist>
<para>
   Landscape formatting is also recommended for printing.
</para>
</sect1>

<sect1 id="options"><title>Options</title>
<para>
   Options and the recent-file-list will be saved when you exit the program,
   and reloaded when you start it. (Menu Settings->Configure &kdiff3; ...)
</para>
<sect2><title>Font</title>
<para>
   Select a fixed width font. (On some systems this dialog will also
   present    variable width fonts, but you should not use them.)
</para>
<variablelist>
   <varlistentry><term><emphasis>Italic Font for Deltas:</emphasis></term><listitem><para> If you select this, then text differences
       will be drawn with the italic version of the selected font. If the font
       doesn't  support italic, then this does nothing.</para>
   </listitem></varlistentry>
</variablelist>
</sect2>

<sect2><title>Colors</title>
<variablelist>
   <varlistentry><term><emphasis>Foreground color:</emphasis></term><listitem><para> Usually black. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Background color:</emphasis></term><listitem><para> Usually white. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Diff Background color:</emphasis></term><listitem><para> Usually light gray. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Color A:</emphasis></term><listitem><para> Usually dark blue. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Color B:</emphasis></term><listitem><para> Usually dark green. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Color C:</emphasis></term><listitem><para> Usually dark magenta. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Conflict Color:</emphasis></term><listitem><para> Usually red.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Current range background color:</emphasis></term><listitem><para> Usually light yellow.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Current range diff background color:</emphasis></term><listitem><para> Usually dark yellow.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Color for manually selected diff ranges:</emphasis></term><listitem><para> Usually orange.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Newest file color in directory comparison:</emphasis></term><listitem><para> Usually green.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Oldest file color in directory comparison:</emphasis></term><listitem><para> Usually red.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Middle age file color in directory comparison:</emphasis></term><listitem><para> Usually dark yellow.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Color for missing files in directory comparison:</emphasis></term><listitem><para> Usually black.</para></listitem></varlistentry>
</variablelist>
<para>
   Changing the colors for directory comparison will be effective only when starting the next directory comparison.
</para>
<para>
   On systems with only 16 or 256 colors some colors are not available in pure
   form. On such systems the "Defaults"-button will choose a pure color.
</para>
</sect2>

<sect2><title>Editor Settings</title>
<variablelist>
   <varlistentry><term><emphasis>Tab inserts spaces:</emphasis></term><listitem><para> If this is disabled and you press the
      tabulator key,   a tab-character is inserted, otherwise the appropriate
      amount  of characters   is inserted.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>   Tab size:</emphasis></term><listitem><para> Can be adjusted for your specific needs. Default is 8. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>   Auto indentation:</emphasis></term><listitem><para> When pressing Enter or Return the indentation
      of the previous  line is used for the new line. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>   Auto copy selection:</emphasis></term><listitem><para> Every selection is immediately copied
      to the clipboard   when active and you needn't explicitely copy it. </para></listitem></varlistentry>
   <varlistentry><term><emphasis>   Line end style:</emphasis></term><listitem><para> When saving you can select what line 
      end style you prefer. The default setting is the common choice for the used operating system. </para></listitem></varlistentry>
</variablelist>
</sect2>

<sect2 id="diffoptions"><title>Diff Settings</title>
<para>
   When comparing files, &kdiff3; first it tries to match lines that are equal
   in all input files. Only during this step it might ignore white space. The
   second step compares each line. In this step white space will not be ignored.
   Also during the merge white space will not be ignored.
</para>

<variablelist>
   <varlistentry><term><emphasis>Preserve Carriage Return:</emphasis></term><listitem><para> Some editors (on some systems) save
      carriage return '\r' and linefeed '\n'-characters at the end of line, while
      others will only save the linefeed '\n'. Usually &kdiff3; ignores the carriage
      return, but then files that don't have equal sizes, look equal in side by
      side comparison. When this option is on, then the carriage return characters
      are made visible but are treated as white space. This option must be off
      during a merge. Default is off.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Ignore numbers:</emphasis></term><listitem><para> Default is off. Number characters ('0'-'9', '.', '-')
      will be ignored  in the first  part of the analysis in which the line matching is
      done. In the result the differences will be shown nevertheless, but they are treated
      as white space.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Ignore C/C++ comments:</emphasis></term><listitem><para> Default is off.
      Changes in comments will be treated like changes in white space.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Ignore case:</emphasis></term><listitem><para>  Default is off. 
      Case-differences of characters (like 'A' vs. 'a') will be treated like changes in white space.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Preprocessor-Command:</emphasis></term><listitem><para>
   See <link linkend="preprocessors">next section</link>.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Line-Matching Preprocessor-Command:</emphasis></term><listitem><para>
   See <link linkend="preprocessors">next section</link>.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Try Hard:</emphasis></term><listitem><para>
      Try hard to find an even smaller delta. (Default is on.) This will probably
      be effective for complicated and big files. And slow for very big files.
   </para></listitem></varlistentry>
</variablelist>
</sect2>

<sect2 id="mergeoptions"><title>Merge Settings</title>
<variablelist>
   <varlistentry><term><emphasis>Auto Advance Delay (ms):</emphasis></term><listitem><para> When in auto-advance-mode this setting specifies
      how long to show the result of the selection before jumping to the next unsolved
      conflict.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>White space 2/3-file merge default:</emphasis></term><listitem><para>
      Automatically solve all white-space conflict by choosing the specified file.
      (Default is manual choice.) Useful if white space really isn't important in many files.
      If you need this only occasionally better use "Choose A/B/C For All Unsolved Whitespace Conflicts"
      in the merge menu. Note that if you enable either "Ignore numbers" or "Ignore C/C++ comments"
      then this auto-choice also applies for conflicts in numbers or comments.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Auto merge regular expression:</emphasis></term><listitem><para>
      Regular expression for lines where &kdiff3; should automatically choose one source. See also <link linkend="vcskeywordsmergesupport">Automatic Merge ...</link>
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Run regular expression auto merge on merge start:</emphasis></term><listitem><para>
      If activated &kdiff3; runs the automatic merge using the "Auto merge regular expression" when a merge is started.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>History start regular expression:</emphasis></term><listitem><para>
      Regular expression for the start of the merge history entry.
      Usually this line contains the "&#36;Log&#36;"-keyword.
      Default value: ".*\&#36;Log.*\&#36;.*"
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>History entry start regular expression:</emphasis></term><listitem><para>
      A merge history entry consists of several lines.
      Specify the regular expression to detect the first line (without the leading comment).
      Use parentheses to group the keys you want to use for sorting.
      If left empty, then &kdiff3; assumes that empty lines separate history entries.
      See also <link linkend="vcskeywordsmergesupport">Automatic Merge ...</link>
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>History merge sorting:</emphasis></term><listitem><para>
      Enable version control history sorting.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>History entry start sort key order:</emphasis></term><listitem><para>
      Each parentheses used in the regular expression for the history start entry
      groups a key that can be used for sorting.
      Specify the list of keys (that are numbered in order of occurrence
      starting with 1) using ',' as separator (e.g. "4,5,6,1,2,3,7").
      If left empty, then no sorting will be done.
      See also <link linkend="vcskeywordsmergesupport">Automatic Merge ...</link>
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Merge version control history on merge start:</emphasis></term><listitem><para>
      If activated &kdiff3; runs the automatic history merging using aforementioned options when a merge is started.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Max number of history entries:</emphasis></term><listitem><para>
      &kdiff3; truncates the history list after the specified number of entries. Use -1 to avoid truncation. (Default is -1).
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Test your regular expressions</emphasis></term><listitem><para>
      This button shows a dialog that allows you to improve and test the regular expressions above.
      Just copy the respective data from your files into the example lines. The "Match results" 
      will immediately show whether the match succeeds or not.
      The "Sort key result" will display the key used for history merge sorting.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Irrelevant merge command:</emphasis></term><listitem><para>
      Specify a command of your own that should be called when &kdiff3; detects 
      that for a three file merge the file from B doesn't contribute any 
      relevant data that isn't already contained in the file from C.
      The command is called with the three filenames as parameters.
      Data matched by the "Auto merge regular expression" or in the 
      history isn't considered relevant.
   </para></listitem></varlistentry>
</variablelist>

</sect2>

<sect2><title>Directory Merge</title>
<para>
   These options are concerned with scanning the directory and handling the
   merge: See the <link linkend="dirmergeoptions">Directory Comparison/Merge
   Docs</link> for details.
</para><para>
Yet there is one option here that is also relevant for saving single files:
</para>
<variablelist>
   <varlistentry><term><emphasis>Backup files:</emphasis></term><listitem><para> When a file is saved and an older version already
      exists, then the original version will be renamed with an ".orig" extension.
      If an old backup file with ".orig" extension already exists then this will
      be deleted without backup.
   </para></listitem></varlistentry>
</variablelist>
</sect2>

<sect2><title>Regional and Language Options</title>
  <variablelist>
    <varlistentry><term><emphasis>Language:</emphasis></term><listitem><para>Adjust the language of the user interface. Changing this option doesn't affect the running program. You have to exit and restart &kdiff3; so that the language is changed. (This option is not available in the KDE version of &kdiff3; because the language is adjustable in the global KDE settings.) 
	</para></listitem></varlistentry>
    <varlistentry><term><emphasis>Use the same encoding for everything:</emphasis></term><listitem><para> The following encoding options can be adjusted separately for each item or if this option is true, all values will take the first value.
	</para></listitem></varlistentry>
    <varlistentry><term><emphasis>Local Encoding:</emphasis></term><listitem><para>Above the codec-selectors appears a note that tells you what the local encoding is. (This is not adjustable but for your information just in case you don't know your local encoding, but need to select it.)
	</para></listitem></varlistentry>
    <varlistentry><term><emphasis>File Encoding for A/B/C:</emphasis></term><listitem><para> Adjust the file encoding for input files. This has an effect on how the special characters are interpreted. Since you can adjust each codec separately you can even compare and merge files that were saved using different codecs.
	</para></listitem></varlistentry>
    <varlistentry><term><emphasis>File Encoding for Merge Output and Saving:</emphasis></term><listitem><para> When you have edited a file, then you can adjust which encoding will be used when saving to disk.
	</para></listitem></varlistentry>
    <varlistentry><term><emphasis>File Encoding for Preprocessor Files:</emphasis></term><listitem><para>When you define preprocessors then they might not be able to operate on your codec. (e.g.: Your files are 16-bit-unicode and your preprocessor can only take 8-bit-ascii.) With this option you can define the encoding of preprocessor output.
	</para></listitem></varlistentry>
    <varlistentry><term><emphasis>Right To Left Language:</emphasis></term><listitem><para>Some languages are written right to left. When this option is enabled, &kdiff3; draws the text from right to left in the diff input windows and in the merge output window. Note that if you start &kdiff3; with the command line option "--reverse" then all layouting will be done right to left too. (This is a feature provided by TQt.) This documentation was written assuming that "Right To Left Language" or reverse layout are disabled. So some references to "left" or "right" must be replaced by their respective counterpart if you use these options.
	</para></listitem></varlistentry>

  </variablelist>
</sect2>

<sect2><title>Miscellaneous</title>
<para>(These options and actions are available in menus or the buttonbar.)</para>
<variablelist>
  <varlistentry><term><emphasis>Show line numbers:</emphasis></term><listitem><para> You can select if line numbers should be
     shown for the input files.</para></listitem></varlistentry>
  <varlistentry><term><emphasis>Show space and tabulator characters for differences:</emphasis></term><listitem><para> Sometimes
     the visible spaces and tabs are disturbing. You can turn this off.</para></listitem></varlistentry>
  <varlistentry><term><emphasis>Show white space:</emphasis></term><listitem><para> Turn this off to suppress
      any highlighting of white-space-only changes in the text or overview-columns.
      (Note that this also applies to changes in numbers or comments if the options "Ignore numbers"
      or "Ignore C/C++ comments" are active.)</para></listitem></varlistentry>
  <varlistentry><term><emphasis>Overview options:</emphasis></term><listitem><para>
     These choices are only available when you compare three files. In normal mode all
     differences are shown in one color-coded overview-column. But sometimes you are  
     especially interested in the differences between only two of these three files.
     Selecting "A vs. B", "A vs. C" or "B vs. C"-overview will show a second overview 
     column with the required information next to the normal overview.
  </para></listitem></varlistentry>
  <varlistentry><term><emphasis>Word wrap diff windows:</emphasis></term><listitem><para>
     Wrap lines when their length would exceed the width of a window.
  </para></listitem></varlistentry>
  <varlistentry><term><emphasis>Show Window A/B/C:</emphasis></term><listitem><para> Sometimes you want to use the space on
      the screen better for long lines. Hide the windows that are not important.
      (In the Windows-menu.)</para></listitem></varlistentry>
  <varlistentry><term><emphasis>Toggle Split Orientation:</emphasis></term><listitem><para>
      Switch between diff windows shown next to each other (A left of B left of C) or above
      each other (A above B above C). This should also help for long lines. (In the Windows-menu.)
      </para></listitem></varlistentry>
  <varlistentry><term><emphasis>Start a merge quickly:</emphasis></term><listitem><para>
      Sometimes you are viewing the deltas and decide to merge.
      <inlinemediaobject><imageobject><imagedata fileref="merge_current.png" format="PNG"/></imageobject></inlinemediaobject>
      "Merge current file" in the Directory-menu also works if you only compare
      two files. A single click starts the merge and uses the filename of the last
      input-file as the default output filename. (When this is used to restart
      a merge, then the output filename will be preserved.)</para></listitem></varlistentry>
</variablelist>
</sect2>

<sect2 id="shortcuts"><title>Configuring Keyboard-Shortcuts</title>
<para>
   Currently only the KDE-version supports user-configurable keyboard-shortcuts.
   (Menu Settings->Configure Shortcuts...)
</para>
</sect2>
</sect1>

<sect1 id="preprocessors"><title>Preprocessor Commands</title>
<para>
&kdiff3; supports two preprocessor options.
</para><para>
<variablelist>
   <varlistentry><term><emphasis>Preprocessor-Command:</emphasis></term><listitem><para>
      When any file is read, it will be piped through this external command.
      The output of this command will be visible instead of the original file.
      You can write your own preprocessor that fulfills your specific needs.
      Use this to cut away disturbing parts of the file, or to automatically
      correct the indentation etc.
   </para></listitem></varlistentry>
   <varlistentry><term><emphasis>Line-Matching Preprocessor-Command:</emphasis></term><listitem><para>
      When any file is read, it will be piped through this external command. If
      a preprocessor-command (see above) is also specified, then the output of the
      preprocessor is the input of the line-matching preprocessor.
      The output will only be used during the line matching phase of the analysis.
      You can write your own preprocessor that fulfills your specific needs.
      Each input line must have a corresponding output line.
   </para></listitem></varlistentry>
</variablelist>
</para>
<para>
The idea is to allow the user greater flexibility while configuring the diff-result.
But this requires an external program, and many users don't want to write one themselves.
The good news is that very often <command>sed</command> or <command>perl</command> 
will do the job. 
</para>
<para>Example: Simple testcase: Consider file a.txt (6 lines):
<screen>
      aa
      ba
      ca
      da
      ea
      fa
</screen>
And file b.txt (3 lines):
<screen>
      cg
      dg
      eg
</screen>
Without a preprocessor the following lines would be placed next to each other:
<screen>
      aa - cg
      ba - dg
      ca - eg
      da
      ea
      fa
</screen>
This is probably not wanted since the first letter contains the actually interesting information.
To help the matching algorithm to ignore the second letter we can use a line matching preprocessor 
command, that replaces 'g' with 'a':
<screen>
   <command>sed</command> 's/g/a/'
</screen>
With this command the result of the comparison would be:
<screen>
      aa
      ba
      ca - cg
      da - dg
      ea - eg
      fa
</screen>
Internally the matching algorithm sees the files after running the line matching preprocessor,
but on the screen the file is unchanged. (The normal preprocessor would change the data also on 
the screen.)
</para>

<sect2 id="sedbasics"><title><command>sed</command> Basics</title>
<para>
This section only introduces some very basic features of <command>sed</command>. For more
information see <ulink url="info:/sed">info:/sed</ulink> or 
<ulink url="http://www.gnu.org/software/sed/manual/html_mono/sed.html">
http://www.gnu.org/software/sed/manual/html_mono/sed.html</ulink>.
A precompiled version for Windows can be found at <ulink url="http://unxutils.sourceforge.net">
http://unxutils.sourceforge.net</ulink>.
Note that the following examples assume that the <command>sed</command>-command is in some 
directory in the PATH-environment variable. If this is not the case, you have to specify the full absolute
path for the command. 
</para>
<note><para>Also note that the following examples use the single quotation mark (') which won't work for Windows. 
On Windows you should use the double quotation marks (") instead.</para></note>
<para>
In this context only the <command>sed</command>-substitute-command is used:
<screen>
   <command>sed</command> 's/<replaceable>REGEXP</replaceable>/<replaceable>REPLACEMENT</replaceable>/<replaceable>FLAGS</replaceable>'
</screen>
Before you use a new command within &kdiff3;, you should first test it in a console.
Here the <command>echo</command>-command is useful. Example:
<screen>
   <command>echo</command> abrakadabra | <command>sed</command> 's/a/o/'
   -> obrakadabra
</screen>
This example shows a very simple sed-command that replaces the first occurance 
of "a" with "o". If you want to replace all occurances then you need the "g"-flag:
<screen>
   <command>echo</command> abrakadabra | <command>sed</command> 's/a/o/g'
   -> obrokodobro
</screen>
The "|"-symbol is the pipe-command that transfers the output of the previous 
command to the input of the following command. If you want to test with a longer file
then you can use <command>cat</command> on Unix-like systems or <command>type</command> 
on Windows-like systems. <command>sed</command> will do the substitution for each line.
<screen>
   <command>cat</command> <replaceable>filename</replaceable> | <command>sed</command> <replaceable>options</replaceable>
</screen>
</para>
</sect2>
<sect2 id="sedforkdiff3"><title>Examples For <command>sed</command>-Use In &kdiff3;</title>
<sect3><title>Ignoring Other Types Of Comments</title>
<para>
Currently &kdiff3; understands only C/C++ comments. Using the
Line-Matching-Preprocessor-Command you can also ignore
other types of comments, by converting them into C/C++-comments.

Example: To ignore comments starting with "#", you would like to convert them
to "//". Note that you also must enable the "Ignore C/C++-Comments" option to get 
an effect. An appropriate Line-Matching-Preprocessor-Command would be:

<screen>
   <command>sed</command> 's/#/\/\//'
</screen>
Since for <command>sed</command> the "/"-character has a special meaning, it is necessary to place the 
"\"-character before each "/" in the replacement-string. Sometimes the "\" is required
to add or remove a special meaning of certain characters. The single quotation marks (') before 
and after the substitution-command are important now, because otherwise the shell will
try to interpret some special characters like '#', '$' or '\' before passing them to 
<command>sed</command>. <emphasis>Note that on Windows you will need the double quotation marks (") here. Windows
substitutes other characters like '%', so you might have to experiment a little bit.</emphasis>
</para>
</sect3>
<sect3><title>Caseinsensitive Diff</title>
<para>
Use the following Line-Matching-Preprocessor-Command to convert all input to uppercase:
<screen>
   <command>sed</command> 's/\(.*\)/\U\1/'
</screen>
Here the ".*" is a regular expression that matches any string and in this context matches 
all characters in the line. 
The "\1" in the replacement string refers to the matched text within the first pair of "\(" and "\)".
The "\U" converts the inserted text to uppercase.
</para>
</sect3>

<sect3><title>Ignoring Version Control Keywords</title>
<para>
CVS and other version control systems use several keywords to insert automatically
generated strings (<ulink url="info:/cvs/Keyword substitution">info:/cvs/Keyword substitution</ulink>).
All of them follow the pattern "$KEYWORD generated text$". We now need a
Line-Matching-Preprocessor-Command that removes only the generated text:
<screen>
   <command>sed</command> 's/\$\(Revision\|Author\|Log\|Header\|Date\).*\$/\$\1\$/'
</screen>
The "\|" separates the possible keywords. You might want to modify this list 
according to your needs.
The "\" before the "$" is necessary because otherwise the "$" matches the end of the line.
</para>
<para>
While experimenting with <command>sed</command> you might come to understand and even like
these regular expressions. They are useful because there are many other programs that also 
support similar things.
</para>
</sect3>

<sect3><title>Ignoring Numbers</title>
<para>
Ignoring numbers actually is a built-in option. But as another example, this is how
it would look as a Line-Matching-Preprocessor-command.
<screen>
   <command>sed</command> 's/[0123456789.-]//g'
</screen>
Any character within '[' and ']' is a match and will be replaced with nothing.
</para>
</sect3>

<sect3><title>Ignoring Certain Columns</title>
<para>
Sometimes a text is very strictly formatted, and contains columns that you always want to ignore, while there are
other columns you want to preserve for analysis. In the following example the first five columns (characters) are 
ignored, the next ten columns are preserved, then again five columns are ignored and the rest of the line is preserved.
<screen>
   <command>sed</command> 's/.....\(..........\).....\(.*\)/\1\2/'
</screen>
Each dot '.' matches any single character. The "\1" and "\2" in the replacement string refer to the matched text within the first 
and second pair of "\(" and "\)" denoting the text to be preserved.
</para>
</sect3>

<sect3><title>Combining Several Substitutions</title>
<para>
Sometimes you want to apply several substitutions at once. You can then use the 
semicolon ';' to separate these from each other. Example:
<screen>
   <command>echo</command> abrakadabra | <command>sed</command> 's/a/o/g;s/\(.*\)/\U\1/'
   -> OBROKODOBRO
</screen>
</para>
</sect3>

<sect3><title>Using <command>perl</command> instead of <command>sed</command></title>
<para>
Instead of <command>sed</command> you might want to use something else like 
<command>perl</command>.
<screen>
   <command>perl</command> -p -e 's/<replaceable>REGEXP</replaceable>/<replaceable>REPLACEMENT</replaceable>/<replaceable>FLAGS</replaceable>'
</screen>
But some details are different in <command>perl</command>. Note that where 
<command>sed</command> needed "\(" and "\)" <command>perl</command>
requires the simpler "(" and ")" without preceding '\'. Example:
<screen>
   <command>sed</command> 's/\(.*\)/\U\1/'
   <command>perl</command> -p -e 's/(.*)/\U\1/'
</screen>
</para>
</sect3>
</sect2>

<sect2><title>Order Of Preprocessor Execution</title>
<para>
The data is piped through all internal and external preprocessors in the 
following order:
</para>
<itemizedlist>
<listitem><para>Normal preprocessor,</para></listitem>
<listitem><para>Line-Matching-Preprocessor,</para></listitem>
<listitem><para>Ignore case (conversion to uppercase),</para></listitem>
<listitem><para>Detection of C/C++ comments,</para></listitem>
<listitem><para>Ignore numbers,</para></listitem>
<listitem><para>Ignore white space</para></listitem>
</itemizedlist>
<para>
The data after the normal preprocessor will be preserved for display and merging. The
other operations only modify the data that the line-matching-diff-algorithm sees.
</para><para>
In the rare cases where you use a normal preprocessor note that 
the line-matching-preprocessor sees the output of the normal preprocessor as input.
</para>
</sect2>

<sect2><title>Warning</title>
<para>
The preprocessor-commands are often very useful, but as with any option that modifies
your texts or hides away certain differences automatically, you might accidentally overlook 
certain differences and in the worst case destroy important data.
</para><para>
For this reason during a merge if a normal preprocessor-command is being used &kdiff3; 
will tell you so and ask you if it should be disabled or not. 
But it won't warn you if a Line-Matching-Preprocessor-command is active. The merge will not complete until
all conflicts are solved. If you disabled "Show White Space" then the differences that
were removed with the Line-Matching-Preprocessor-command will also be invisible. If the 
Save-button remains disabled during a merge (because of remaining conflicts), make sure to enable 
"Show White Space". If you don't wan't to merge these less important differences manually
you can select "Choose [A|B|C] For All Unsolved White space Conflicts" in the Merge-menu.
</para>
</sect2>
</sect1>
</chapter>


<chapter id="dirmerge"><title>Directory Comparison and Merge with &kdiff3;</title>
<sect1 id="dirmergeintro"><title>Introduction into Directory Comparison and Merge</title>
<para>
   Often programmers must modify many files in a directory to achieve their
   purpose. For this &kdiff3; also lets you compare and merge complete directories
   recursively!
</para><para>
   Even though comparing and merging directories seems to be quite obvious,
   there are several details that you should know about. Most important is of
   course the fact that now many files might be affected by each operation.
   If you don't have backups of your original data, then it can be very hard
   or even impossible to return to the original state. So before starting a merge,
   make sure that your data is safe, and going back is possible. If you make
   an archive or use some version control system is your decision, but even
   experienced programmers and integrators need the old sources now and then.
   And note that even though I (the author of &kdiff3;) try to do my best, I can't
   guarantee that there are no bugs. According to the GNU-GPL there is NO WARRANTY
   whatsoever for this program. So be humble and always keep in mind:
</para>
<blockquote><para>
   <emphasis>To err is human, but to really mess things up you need a computer.</emphasis>
</para></blockquote>
<para>
So this is what this program can do for you: &kdiff3; ...
</para>
<itemizedlist>
     <listitem><para>... reads and compares two or three directories recursively,</para></listitem>
     <listitem><para>... takes special care of symbolic links,</para></listitem>
     <listitem><para>... lets you browse files on mouse double click,</para></listitem>
     <listitem><para>... for each item proposes a merge operation, which you can change
                         before starting the directory merge,</para></listitem>
     <listitem><para>... lets you simulate the merge and lists the actions that would
                         take  place, without actually doing them,</para></listitem>
     <listitem><para>... lets you really do the merge, and lets you interact whenever
                         manual interaction is needed,</para></listitem>
     <listitem><para>... lets you run the selected operation for all items (key F7) or the selected item (key F6),</para></listitem>
     <listitem><para>... lets you continue the merge after manual interaction with key F7,</para></listitem>
     <listitem><para>... optionally creates backups, with the ".orig" extension,</para></listitem>
     <listitem><para>...</para></listitem>
</itemizedlist>
</sect1>

<sect1 id="startingdirmerge"><title>Starting Directory Comparison Or Merge</title>
<para>
   This is very similar to the single file merge and comparison. You just
   have  to specify directories on the command line or in the file-open
   dialog.
</para>
<sect2><title>Compare/Merge two directories: </title>
<screen>
   <command>kdiff3</command> <replaceable>dir1 dir2</replaceable>
   <command>kdiff3</command> <replaceable>dir1 dir2</replaceable> -o <replaceable>destdir</replaceable>
</screen>
<para>
   If no destination directory is specified, then &kdiff3; will use <replaceable>dir2</replaceable>.
</para>
</sect2>

<sect2><title>Compare/Merge three directories: </title>
<screen>
   <command>kdiff3</command> <replaceable>dir1 dir2 dir3</replaceable>
   <command>kdiff3</command> <replaceable>dir1 dir2 dir3</replaceable> -o <replaceable>destdir</replaceable>
</screen>
<para>
   When three directories are merged then <replaceable>dir1</replaceable>
   is used as the base for the merge.
   If no destination directory is specified, then &kdiff3; will use <replaceable>dir3</replaceable>
   as the  destination directory for the merge.
</para>

<para>
   Note that only the comparison starts automatically, not the merge. For this you first must
   select a menu entry or the key F7. (More details later.)
</para>
</sect2>
</sect1>

<sect1 id="dirmergevisible"><title>Directory Merge Visible Information</title>
<para>
   While reading the directories a message-box appears that informs you of
   the progress. If you abort the directory scan, then only files that have
   been  compared until then will be listed.
</para><para>
   When the directory scan is complete then &kdiff3; will show a listbox with
   the results left, ...
</para>
<screenshot><mediaobject>
<imageobject><imagedata fileref="dirbrowser.png" format="PNG"/></imageobject> <!--alt="Image of the directory browser."-->
</mediaobject></screenshot>
<para>
   ... and details about the currently selected item on the right:
</para>
<screenshot><mediaobject>
<imageobject><imagedata fileref="iteminfo.png" format="PNG"/></imageobject>
   <!--alt="Image with information about the selected item."-->
</mediaobject></screenshot>

<sect2 id="name"><title>The Name Column</title>
<para>
   Each file and directory that was found during the scan is shown here in
   a tree. You can select an item by clicking it with the mouse once.
</para><para>
   The directories are collapsed by default. You can expand and collapse
   them by clicking on the "+"/"-" or by double-clicking the item or
   by using  the left/right-arrow-keys. The "Directory"-menu also contains two
   actions "Fold all subdirs" and "Unfold all subdirs" with which you can
   collapse or expand all directories at once.
</para><para>
   If you double-click a file item then the file comparison starts and the
   file-diff-window will appear.
</para>
<para>
   The image in the name column reflects the file type in the first
   directory  ("A"). It can be one of these:
</para>
<itemizedlist>
     <listitem><para>Normal file</para></listitem>
     <listitem><para>Normal directory (directory-image)</para></listitem>
     <listitem><para>Link to a file (file-image with a link arrow)</para></listitem>
     <listitem><para>Link to a directory (directory-image with a link arrow)</para></listitem>
</itemizedlist>
<para>
   If the file type is different in the other directories, then this is visible
   in the columns A/B/C and in the window that shows the details about the selected
   item. Note that for such a case no merge operation can be selected automatically.
   When starting the merge, then the user will be informed of problems of that
   kind.
</para>
</sect2>

<sect2 id="coloring"><title>The Columns A/B/C and the Coloring Scheme</title>
<para>
   As can be seen in the image above the colors red, green, yellow and black
   are used in the columns A/B/C.
</para>
<itemizedlist>
     <listitem><para>Black: This item doesn't exist in this directory.</para></listitem>
     <listitem><para>Green: Newest item.</para></listitem>
     <listitem><para>Yellow: Older than green, newer than red.</para></listitem>
     <listitem><para>Red: Oldest item.</para></listitem>
</itemizedlist>
<para>
   But for items that were identical in the comparison their color also is
   identical even if the age is not.
</para><para>
   Directories are considered equal if all items they contain are identical.
   Then they also will have the same color. But the age of a directory is not
   considered for its color.
</para><para>
   The idea for this coloring scheme I came upon in
   <ulink url="http://samba.org/cgi-bin/cvsweb/dirdiff">dirdiff</ulink>. The colors
   resemble the colors of a leaf that is green when new, turns yellow later and red
   when old.
</para>

</sect2><sect2 id="operation"><title>The Operation Column</title>
<para>
   After comparing the directories &kdiff3; also evaluates a proposal for a
   merge  operation. This is shown in the "Operation" column. You can modify
   the operation  by clicking on the operation you want to change. A small menu
   will popup and allows you to select an operation for that item. (You can also
   select the most needed operations via keyboard.
   Ctrl+1/2/3/4/Del will select A/B/C/Merge/Delete respectively if available.)
   This operation will be executed during the merge. It depends on the item and
   on the merge-mode you are in, what operations are available. The merge-mode is one of
</para>
<itemizedlist>
     <listitem><para>Three directory-merge ("A" is treated as older base of both).</para></listitem>
     <listitem><para>Two directory-merge.</para></listitem>
     <listitem><para>Two directory-sync-mode (activate via option "Synchronize Directories").</para></listitem>
</itemizedlist>
<para>
   In three directory merge the operation proposal will be: If for an item ...
</para>
<itemizedlist>
     <listitem><para>... all three directories are equal: Copy from C</para></listitem>
     <listitem><para>... A and C are equal but B is not: Copy from B (or if B does not
                         exist, delete the destination if exists)</para></listitem>
     <listitem><para>... A and B are equal but C is not: Copy from C (or if C does not
                         exist, delete the destination if exists)</para></listitem>
     <listitem><para>... B and C are equal but A is not: Copy from C (or if C does not
                         exist, delete the destination if exists)</para></listitem>
     <listitem><para>... only A exists: Delete the destination (if exists)</para></listitem>
     <listitem><para>... only B exists: Copy from B</para></listitem>
     <listitem><para>... only C exists: Copy from C</para></listitem>
     <listitem><para>... A, B and C are not equal: Merge</para></listitem>
     <listitem><para>... A, B and C don't have the same file type (e.g. A is a directory,
                         B is a file): "Error: Conflicting File Types". While such items exist the
                         directory merge cannot start.</para></listitem>
</itemizedlist>
<para>
   In two directory merge the operation proposal will be: If for an item ...
</para>
<itemizedlist>
     <listitem><para>... both directories are equal: Copy from B</para></listitem>
     <listitem><para>... A exists, but not B: Copy from A</para></listitem>
     <listitem><para>... B exists, but not A: Copy from B</para></listitem>
     <listitem><para>... A and B exist but are not equal: Merge</para></listitem>
     <listitem><para>... A and B don't have the same file type (e.g. A is a directory,
                         B is a file): "Error: Conflicting File Types". While such items exist the
                         directory merge cannot start.</para></listitem>
</itemizedlist>
<para>
   Sync-mode is active if only two directories and no explicit destination
   were specified and if the option "Synchronize directories" is active. &kdiff3;
   then selects a default operation so that both directories are the same afterwards.
   If for an item ...
</para>
<itemizedlist>
     <listitem><para>... both directories are equal: Nothing will be done.</para></listitem>
     <listitem><para>... A exists, but not B: Copy A to B</para></listitem>
     <listitem><para>... B exists, but not A: Copy B to A</para></listitem>
     <listitem><para>... A and B exist, but are not equal: Merge and store the result
                         in  both directories. (For the user the visible save-filename is B,
                         but then &kdiff3; copies B also to A.)</para></listitem>
     <listitem><para>... A and B don't have the same file type (e.g. A is a directory,
                         B is a file): "Error: Conflicting File Types". While such items exist the
                         directory merge cannot start.</para></listitem>
</itemizedlist>
<para>
   When two directories are merged and the option "Copy newer instead of merging" is selected,
   then &kdiff3; looks at the dates and proposes to choose the newer file. If the files are not
   equal but have equal dates, then the operation will contain
   "Error: Dates are equal but files are not." While such items exist the
   directory merge cannot start.
</para>
</sect2>

<sect2 id="status"><title>The Status Column</title>
<para>
   During the merge one file after the other will be processed. The status
   column will show "Done" for items where the merge operation has succeeded,
   and other texts if something unexpected happened. When a merge is complete,
   then you should make a last check to see if the status for all items is
   agreeable.
</para>
</sect2>

<sect2 id="statisticscolulmns"><title>Statistics Columns</title>
<para>
   When the file comparison mode "Full Analysis" is enabled in the options, then
   &kdiff3; will show extra columns containing the numbers of unsolved, solved, nonwhite and whitespace
   conflicts. (The solved-column will only show when comparing or merging three directories.)
</para>
</sect2>

<sect2 id="selectingvisiblefiles"><title>Selecting Listed Files</title>
<para>   
   Several options influence which files are listed here. Some are accessible in the 
   <link linkend="dirmergeoptions">settings dialog</link>. The Directory-menu contains the entries:
</para><para><itemizedlist>
     <listitem><para>"Show Identical Files": Files that have been detected equal in all input directories.</para></listitem>
     <listitem><para>"Show Different Files": Files that exist in two or more directories but are not equal.</para></listitem>
     <listitem><para>"Show Files only in A": Files that exist only in A, but not in B or C.</para></listitem>
     <listitem><para>"Show Files only in B": Files that exist only in B, but not in A or B.</para></listitem>
     <listitem><para>"Show Files only in C": Files that exist only in C, but not in A or B.</para></listitem>
</itemizedlist></para>
<para>
   Activate only the "Show"-options for the items you want listed. If for example you only want to list all items that 
   exist either in A or in B but not in both, you'll have to activate "Show Files only in A" and "Show Files only in B" 
   and deactivate all others ("Show Identical Files", "Show Different Files", "Show Files only in C").
   The list will be updated immediately to reflect the change.
</para><para>
   These options also apply for directories with one exception: Disabling "Show Different Files" will not hide 
   any complete directories. This will work only for files within.
</para><para>
   Note that of these only the "Show Identical Files"-option is persistant. The others are enabled when starting &kdiff3;. 
</para>
</sect2>

</sect1>


<sect1 id="dothemerge"><title>Doing A Directory Merge</title>
<para>
   You can either merge the currently selected item (file or directory), or all items.
   When you have made all your operation choices (in all subdirectories too)
   then you can start the merge.
</para><para>
   Be aware that if you didn't specify a destination directory explicitely,
   then the destination will be "C" in three directory mode, "B" in two directory
   merge mode, and in sync-mode it will be "A" or/and "B".
</para><para>
   If you have specified a destination directory also check that all items
   that should be in the output, are in the tree. There are some options that
   cause certain items to be omitted from the directory comparison and merge.
   Check these options to avoid unpleasant surprises:
</para>
<itemizedlist>
     <listitem><para>"Recursive Directories": If this is off, then items in subdirectories
                     will not be found.</para></listitem>
     <listitem><para>"Pattern"/"Anti-Pattern": Include/exclude items that match</para></listitem>
     <listitem><para>"Exclude Hidden Files"</para></listitem>
     <listitem><para><link linkend="selectingvisiblefiles">"Show"-options</link> (Show Identical/Different Files, Files only in A/B/C)</para></listitem>
</itemizedlist>
<para>
   If you change the settings in order to list more files, you must do a rescan via menu "Directory"->"Rescan" yourself.
   (The reason for this is that for faster comparison-speed &kdiff3; omits the comparison for files suppressed by these criteria.)
   If you changed your file and dir patterns to exclude files, then the file-list will immediately be updated on closing
   the options-dialog.
</para><para>
   Note that when you write to a completely new directory then you usually also want to copy the identical files.
   In that case enable the "Show Identical Files"-option. If your destination-directory is one of the inputs, 
   then this isn't necessary because the file is already there.
</para><para>
   If you are satisfied so far, the rest is easy.
</para><para>
   To merge all items: Select "Start/Continue directory merge" in the "Directory"-menu
   or press F7 (which is the default shortcut).
   To merge only the current item: Select "Run Operation For Current Item"
   or press F6.
</para><para>
   If due to conflicting filetypes still some items with invalid operations
   exist, then a messagebox will appear and these items will be pointed out,
   so you can select a valid operation for the item.
</para><para>
   If you merge all items a dialog will appear giving you the options "Do it", "Simulate
   it" and "Cancel".
</para>
<itemizedlist>
     <listitem><para>Select "Simulate it" if you want to see what would be done without
                     actually doing it. A verbose list of all operations will be shown.</para></listitem>
     <listitem><para>Otherwise select "Do it" to really start merging.</para></listitem>
</itemizedlist>
<para>
   Then &kdiff3; will run the specified operation for all items. If manual
   interaction  is required (single file merge), then a merge window will open
   (<link linkend="dirmergebigscreenshot">see the big screenshot</link>).
</para><para>
   When you have finished with manually merging a file, again select "Start/Continue directory
   merge" or the key F7. If you haven't saved it yet, a dialog will ask you to
   do so. Then &kdiff3; will continue with the next item.
</para><para>
   When &kdiff3; encounters an error, it will tell you so and will show the
   verbose-status-information. At the bottom of this list, there will be some
   error messages which should help you to understand the cause of the problem.
   When you continue merging (F7 key) &kdiff3; will give you the choice to retry
   or skip the item that caused the problem. This means that before continuing
   you can choose another operation or solve the problem by other means.
</para><para>
   When the merge is complete, then &kdiff3; will inform you via a message
   box.
</para><para>
   If some items were merged individually before running the directorymerge then 
   &kdiff3; remembers this (while this
   merge-session goes on), and doesn't merge them again when later the merge for
   all items is run. Even when the merge was skipped or nothing was saved these
   items count as completed. Only when you change the merge operation the 
   "Done"-status of the item will be removed and it can be merged again.
</para>
</sect1>

<sect1 id="dirmergeoptions"><title>Options for Comparing and Merging Directories</title>
<para>
   The &kdiff3;-preferences (menu "Settings"-&gt;"Configure &kdiff3;") has
   a section called "Directory Merge" with these options:
</para>

<variablelist>
   <varlistentry><term><emphasis>Recursive Directories:</emphasis></term><listitem><para> Select whether to search directories
         recursively.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>File Pattern(s):</emphasis></term><listitem><para> Only files that match any pattern here will
         be put in the tree. More than one pattern may be specified here by using
         the semicolon ";" as separator. Valid wildcards: '*' and '?'. (e.g. "*.cpp;*.h").
         Default is "*". This pattern is not used on directories.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>File Anti-Pattern(s):</emphasis></term><listitem><para> Files that match this pattern
         will be excluded from the tree. More than one pattern may be specified here
         via using the semicolon ";" as separator. Valid wildcards: '*' and '?'. Default
         is "*.orig;*.o;*.obj".</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Directory Anti-Pattern(s):</emphasis></term><listitem><para> Directories that match this pattern
         will be excluded from the tree. More than one pattern may be specified here
         via using the semicolon ";" as separator. Valid wildcards: '*' and '?'. Default
         is "CVS;deps;.svn".</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Use CVS-Ignore:</emphasis></term><listitem><para>
         Ignore files and directories that would also be ignored by CVS.
         Many automatically generated files are ignored by CVS.
         The big advantage is that this can be directory specific via a local ".cvsignore"-file.
         (See <ulink url="info:/cvs/cvsignore">info:/cvs/cvsignore</ulink>.)</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Find Hidden Files and Directories:</emphasis></term><listitem><para> On some file systems files
         have an "Hidden"-attribute. On other systems a filename starting with a dot
         "." causes it to be hidden. This option allows you to decide whether to
         include  these files in the tree or not. Default is on.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Follow File Links:</emphasis></term><listitem><para> For links to files: When disabled, then
         the symbolic links are compared. When enabled, then the files behind the
         links are compared. Default is off.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Follow Directory Links:</emphasis></term><listitem><para> For links to directories: When disabled,
         then the symbolic links will be compared. When enabled then the link will
         be treated like a directory and it will be scanned recursively. (Note that
         the program doesn't check if the link is "recursive". So for example a directory
         that contains a link to the directory would cause an infinite loop, and after
         some time when the stack overflows or all memory is used up, crash the program.)
         Default is off.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Case Sensitive Filename Comparison:</emphasis></term><listitem><para> 
         Default is false on Windows, true for other operating systems.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>File Comparison Mode:</emphasis></term><listitem><para>
<variablelist>            
   <varlistentry><term><emphasis>Binary Comparison:</emphasis></term><listitem><para>
         This is the default file comparison mode.
         </para></listitem></varlistentry>         
   <varlistentry><term><emphasis>Full Analysis:</emphasis></term><listitem><para>
         Do a full analysis of each file and show the statistics information columns.
         (Number of solved, unsolved, nonwhite and white conflicts.)
         The full analysis is slower than a simple binary analysis, and much
         slower when used on files that don't contain text. 
         (Specify the appropriate file-antipatterns.)
         </para></listitem></varlistentry>         
   <varlistentry><term><emphasis>Trust the modification date:</emphasis></term><listitem><para> If you compare big directories
         over a slow network, it might be faster to compare the modification dates
         and file length alone. But this speed improvement comes with the price of
         a little uncertainty. Use this option with care. Default is off.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Trust the size:</emphasis></term><listitem><para>
         Similar to trusting the modification date. No real comparison happens. Two
         files are considered equal if their file-sizes are equal. This is useful
         when the file-copy operation didn't preserve the modification date.
         Use this option with care. Default is off.</para></listitem></varlistentry>
</variablelist></para></listitem></varlistentry>
         
   <varlistentry><term><emphasis>Synchronize Directories:</emphasis></term><listitem><para> Activates "Sync-Mode" when two directories
         are compared and no explicit destination directory was specified. In this
         mode the proposed operations will be chosen so that both source directories
         are equal afterwards. Also the merge result will be written to both directories.
         Default is off.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Copy newer instead of merging:</emphasis></term><listitem><para> Instead of merging the proposed
         operation will copy the newer source if changes happened. (Considered unsafe,
         because it implies that you know, that the other file hasn't been edited
         too. Check to make sure in every case.) Default is off.</para></listitem></varlistentry>
   <varlistentry><term><emphasis>Backup files:</emphasis></term><listitem><para> If a file or complete directory is replaced
         by  another or is deleted then the original version will be renamed with an
         ".orig"  extension. If an old backup file with ".orig" extension already exists
         then  this will be deleted without backup. This also affects the normal merging
         of single files, not only in directory-merge mode. Default is on.</para></listitem></varlistentry>
</variablelist>
</sect1>

<sect1 id="other"><title>Other Functions in Directory Merge Window</title>
<sect2><title>Split/Full Screen Mode</title>
<para>
   Usually the directory merge list view remains visible while a single file
   is compared or merged. With the mouse you can move the the splitter bar that
   separates the file list from the text-diff windows. If you don't want this,
   you can disable "Split Screen View" in the "Directory"-menu. Then you can
   use "Toggle View" in the "Directory"-menu to switch between the file list
   and the text-diff view that then occupy the full screen.
</para>
</sect2>
<sect2><title>Comparing or Merging a Single File</title>
<para>
   Probably you will prefer a simple double mouse click on a file in order
   to compare it. Nevertheless there also exists an entry in the "Directory"-menu.
   You can also directly merge a single file by selecting it and 
   choosing "Merge current file" in the "Merge"-Menu. On saving the
   result, the status will be set to done, and the file will not be merged again
   if a directory merge is started.
</para><para>
   But note that this status information will be lost when you rerun a directory
   scan: "Directory"-menu: "Rescan"
</para>
</sect2>
<sect2><title>Comparing or Merging Files with Different Names</title>
<para>
   Sometimes you need to compare or merge files with different names (e.g. the current 
   file and the backup in the same folder).
</para><para>
   Select the exact file by clicking onto the icon in the column A, B or C. The first 
   file selected thus will be marked with an "A", the second and third with "B" and "C" 
   regardless on what column they are in. Only up to three files can be chosen like this.
</para><para>
   Proceed by choosing "Compare Explicitely Selected Files" or "Merge Explicitely 
   Selected Files" from the "Directory"-menu. For your convenience these menu entries 
   also appear as context menu when you right-click the last selected file.
</para><para>
   The comparison or merge of a file will happen in the same window. 
   If this method is used for directories a new window will be opened.
</para></sect2>
</sect1>
</chapter>

<chapter id="misc">
<title>Miscellaneous Topics</title>
<sect1 id="networktransparency">
<title>Networktransparency via TDEIO</title>
<sect2><title>TDEIO-Slaves</title>
<para>
KDE supports networktransparency via TDEIO-slaves. &kdiff3; uses this
for reading input files and for scanning directories.
This means that you can specify files and directories on local and
remote resources via URLs.
</para><para>
Example:
</para><para>
<screen>
   <command>kdiff3</command> test.cpp  ftp://ftp.faraway.org/test.cpp
   <command>kdiff3</command> tar:/home/hacker/archive.tar.gz/dir ./dir
</screen>
</para>
<para>The first line compares a local file with a file on an FTP-server. The second line
compares a directory within an compressed archive with a local directory.
</para><para>
Other TDEIO-slaves that are interesting are:
</para>
<itemizedlist>
<listitem><para>Files from the WWW (http:),</para></listitem>
<listitem><para>Files from the FTP (ftp:),</para></listitem>
<listitem><para>Encrypted file transfer (fish:, sftp:),</para></listitem>
<listitem><para>Windows-ressources (smb:),</para></listitem>
<listitem><para>Local files (file:),</para></listitem>
</itemizedlist>
<para>
Other things that are possible, but probably less useful are:
</para>
<itemizedlist>
<listitem><para>Man-pages (man:),</para></listitem>
<listitem><para>Info-pages (info:),</para></listitem>
</itemizedlist>
</sect2>

<sect2><title>How To Write URLs</title>
<para>
   An URL has a different syntax compared with paths for local files and directories.
   Some things should be considered:
</para>
<itemizedlist>
<listitem><para>
   A path can be relative and can contain "." or "..". This is not possible for URLs
   which are always absolute.
</para></listitem><listitem><para>
   Special characters must be written with "escaping". ("#"->"%23", space->"%20", etc.)
   E.g. A file with the name "/#foo#" would have the URL "file:/%23foo%23".
</para></listitem><listitem><para>
   When URLs don't work as expected, try to open them in Konqueror first.
</para></listitem>
</itemizedlist>

</sect2>

<sect2><title>Capabilities of TDEIO-Slaves</title>
<para>
   Networktransparency has one drawback: Not all ressources have the same cababilities.
</para><para>
   Sometimes this is due to the file system of the server, sometimes due to the protocol.
   Here is a short list of restrictions:
</para>
<itemizedlist>
<listitem><para>
   Sometimes there is no support for links.
</para></listitem><listitem><para>
   Or there is no way to distinguish if a link points to a file or a directory; always
   assuming a file. (ftp:, sftp:).
</para></listitem><listitem><para>
   Can't always determine the filesize.
</para></listitem><listitem><para>
   Limited support for permissions.
</para></listitem><listitem><para>
   No possibility to modify permissions or modification time, so permissions or time
   of a copy will differ from the original. (See the option "Trust the size".)
   (To modify permissions or modification time is only possible for local files.)
</para></listitem>
</itemizedlist>
</sect2>
</sect1>

<sect1 id="kpart">
<title>Using &kdiff3; as a KPart</title>
<para>
&kdiff3; is a KPart. Currently it implements the KParts::ReadOnlyPart-interface.
</para><para>
It's main use is as difference-viewer in KDevelop. KDevelop always starts the
internal difference viewer first. To invoke &kdiff3; press the right mouse button
on the difference viewer window and select "Show in KDiff3Part" from the contextmenu.
</para><para>
&kdiff3; normally requires two complete files as input. When used as part &kdiff3;
will assume that the inputfile is a patch-file in the unified format. &kdiff3;
then retrieves the original filenames from the patch-file. At least one of
the two files must be available. &kdiff3; will then invoke <command>patch</command> to
recreate the second file.
</para><para>
In Konqueror you can select a patch-file and select "Preview in"-"KDiff3Part" from
the contextmenu. Be aware that this won't work if none of the original files are
available, and it is not reliable if the original file(s) have changed since the
patch-file was generated.
</para><para>
When run as a part &kdiff3; only provides the a two-file-diff, a very small toolbar
and menu. Merging or directory-comparison are not supported then.
</para>
</sect1>
</chapter>

<chapter id="faq">
<title>Questions and Answers</title>

&reporting.bugs;
&updating.documentation;

<qandaset id="faqlist">

<qandaentry><question><para>
   Why is it called "&kdiff3;"?
</para></question><answer><para>
   Tools named "KDiff" and "KDiff2" (now called "Kompare") already exist. Also "KDiff3" should suggest
   that it can merge like the "diff3"-tool in the Diff-Tool collection.
</para></answer></qandaentry>

<qandaentry><question><para>
   Why did I release it under GPL?
</para></question><answer><para>
   I'm using GPL programs for a very long time now and learned very much
   by  having a look at many of the sources. Hence this is my "Thank You"
   to   all  programmers that also did so or will do the same.
</para></answer></qandaentry>

<qandaentry><question><para>
   Some buttons and functions are missing. What's wrong?
</para></question><answer><para>
   You compiled from source but you probably didn't specify the correct KDE-prefix
   with configure. By default configure wants to install in /usr/local but then KDE can't
   find the user-interface ressource file (i.e. kdiff3ui.rc). The README-file contains
   more information about the correct prefix.
</para></answer></qandaentry>

<qandaentry><question><para>
   Often lines that are similar but not identical appear next to each other
   but sometimes not. Why?
</para></question><answer><para>
   Lines where only the amount of white space characters is different
   are   treated as "equal" at first, while just one different non-white character
   causes the lines to be "different". If similar lines appear next to each
   other, this actually is coincidence but this fortunately is often the case.
   See also <link linkend="manualdiffhelp">Manual Diff Help</link>.
</para></answer></qandaentry>

<qandaentry><question><para>
   Why must all conflicts be solved before the merge result can be saved?
</para></question><answer><para>
   For each equal or different section the editor in the merge result
   window    remembers where it begins or ends. This is needed so that conflicts
   can  be solved manually by simply selecting the source button (A, B or C).
   This  information is lost while saving as text and it is too much effort to
   create  a special file format that supports saving and restoring all necessary
   information.
</para></answer></qandaentry>

<qandaentry><question><para>
   How can I synchronise the diff and merge views, so that all views show the same text position?
</para></question><answer><para>
  Click into the summary column left of the text. (<link linkend="synchronise_views">See also here.</link>)
</para></answer></qandaentry>

<qandaentry><question><para>
   Why does the editor in the merge result window not have an "undo"-function?
</para></question><answer><para>
  This was too much effort until now. You can always
  restore a version from one source (A, B or C) by clicking the respective
  button. For big editing the use of another editor is recommended anyway.
</para></answer></qandaentry>

<qandaentry><question><para>
   When I removed some text, then suddenly "&lt;No src line&gt;" appeared
   and cannot be deleted. What does that mean and how can one remove this?
</para></question><answer><para>
   For each equal or different section the editor in the merge result
   window    remembers where it begins or ends. "&lt;No src line&gt;" means
   that    there is nothing left in a section, not even a new line character.
   This  can happen either while merging automatically or by editing. This is
   no problem,   since this hint won't appear in the saved file. If you want
   the orignal source  back just select the section (click on the left summary
   column) and then click the source button with the needed contents (A/B or
   C).
</para></answer></qandaentry>

<qandaentry><question><para>
   Why doesn't &kdiff3; support syntax-highlighting?
</para></question><answer><para>
   &kdiff3; already uses many colors for difference highlighting. More
   highlighting    would be confusing. Use another editor for this.
</para></answer></qandaentry>

<qandaentry><question><para>
   Can I use &kdiff3; to compare OpenOffice.Org, Word, Excel, PDF-, &etc; files?
</para></question><answer><para>
   Although &kdiff3; will analyse any kind of file the result will probably
   not be very satisfactory for you.
</para><para>
   &kdiff3; was made to compare pure text files. OpenOffice, Word, Excel etc.
   store much more information in the files (about fonts, pictures, pages,
   colors etc.) which &kdiff3; doesn't know about. So &kdiff3; will 
   show you the contents of the file interpreted as pure text, but 
   this might be unreadable or at least it will look very odd.
</para><para>
   Since most programs nowadays store their contents in XML-format, you might 
   be able to read it as pure text. So if the change was only small,
   &kdiff3; still might help you.
</para><para>
   The best solution if you only want to compare the text (without embedded 
   objects like pictures) is to use "Select All" and "Copy" in your program 
   to copy the interesting text to the clipoard and then in &kdiff3; paste the 
   text into either diff input window. 
   (See also <link linkend="selections">Select, Copy And Paste</link>.)
</para></answer></qandaentry>

<qandaentry><question><para>
   Where has the the directory option "List only deltas" gone?
</para></question><answer><para>
   There are now several <link linkend="selectingvisiblefiles">"Show"-options</link> in the directory menu.
   Disabling "Show identical files" will achieve what enabling "List only deltas" used to do.
</para></answer></qandaentry>

<qandaentry><question><para>
   How can I make a big selection in the diff input window
   because scrolling takes so long?
</para></question><answer><para>
   Start the selection as usual (click and hold the left mouse button). 
   Then use the navigation keys (e.g. page up, page down) while holding the left mouse button down.
   (See also <link linkend="selections">Select, Copy And Paste</link>.)
</para></answer></qandaentry>

<qandaentry><question><para>
   There is so much information here, but your question is still not answered?
</para></question><answer><para>
   Please send me your question. I appreciate every comment.
</para></answer></qandaentry>

</qandaset>
</chapter>

<chapter id="credits">

<title>Credits and License</title>

<para>
&kdiff3; - File and Directory Comparison and Merge Tool
</para>
<para>
Program copyright 2002-2007 Joachim Eibl <email>joachim.eibl at gmx.de</email>
</para>
<para>
Several cool ideas and bugreports came from colleagues and many people out in the Wild Wild Web. Thank you!
</para>

<para>
Documentation Copyright &copy; 2002-2007 Joachim Eibl <email>joachim.eibl at gmx.de</email>
</para>

<!-- TRANS:CREDIT_FOR_TRANSLATORS -->

&underFDL;               <!-- FDL: do not remove -->


&underGPL;        	 <!-- GPL License -->

</chapter>

<appendix id="installation">
<title>Installation</title>

<sect1 id="getting-kdiff3">
<title>How to obtain &kdiff3;</title>

<para>
You can download the latest version of &kdiff3; from its homepage <ulink url="http://kdiff3.sourceforge.net">http://kdiff3.sourceforge.net</ulink>.
</para><para>
&kdiff3; is also available for other platforms. See the homepage for details.
</para>


</sect1>

<sect1 id="requirements">
<title>Requirements</title>

<para>
   In order to successfully use all features of &kdiff3;, you need &kde; >3.1.
</para><para>
   For information about how to run &kdiff3; on other platforms without KDE please see the
   <ulink url="http://kdiff3.sourceforge.net">homepage</ulink>.
</para><para>
You can find a list of changes at <ulink
url="http://kdiff3.sourceforge.net/ChangeLog">http://kdiff3.sourceforge.net/ChangeLog</ulink>
or in the "ChangeLog"-file of the source package.
</para>
</sect1>

<sect1 id="compilation">
<title>Compilation and Installation</title>

<para>In order to compile and install &kdiff3; on a system with KDE, type the
following in the base directory of the &kdiff3; distribution:</para>

<screen><prompt>%</prompt> <userinput><command>./configure --prefix=<replaceable>kde-dir</replaceable></command></userinput>
<prompt>%</prompt> <userinput><command>make</command></userinput>
<prompt>%</prompt> <userinput><command>make</command> install</userinput>
</screen>
<para>
<replaceable>kde-dir</replaceable> specifies the directory
containing KDE on your system. If you are not sure, read the README-file for details.
</para>
<para>If you don't use KDE don't use <command>configure</command> but follow the instructions for TQt-only systems in the README file.</para>
<para>Since &kdiff3; uses <command>autoconf</command> and
<command>automake</command> you should have no trouble compiling it. Should you
run into problems please report them to the &kde; mailing lists.</para>

</sect1>

</appendix>

&documentation.index;
</book>