Navigation: TextEd > Introduction > Tutorials and misc functions >

Text Compare Mode

 

 

 

To compare two documents you should first activate "Windows -> Dual document view" and open the two files side by side.
 

In the tools menu select "Text Comparison -> Compare documents". You can find the compare items in the document tab context menu as well.
 


[+]          marks added lines.

[-]          marks deleted lines.

[~]          marks modified lines.

 

You can place the mouse inside a difference section and open the context menu (right mouse click) to find a few commands.

You can also click the left mouse button over a section mark in the left margin to open an action menu.
 

Both menus contain items to copy a diff section, or a line, to the other side, copy the diff section to the clipboard or save all differences to a file (patch file).
 


 

Below the documents is the line inspector:

 


 

Use it to see the differences between the left and right lines. The left is always displayed at the top.

The arrow buttons can be used to copy the line to the other side.
 

Compare mode is indicated in the status bar:
 

You can click on "Compare" to exit compare mode. You can of course exit compare mode using one of the menu items as well.

Normal editing while in compare mode

Most edit functions are available in compare mode. Some functions are disabled because they wont work in compare mode or because they may cause issues.

One thing you may notice while editing is that in compare mode the two compared documents have the same undo/redo buffer. So an undo/redo action may make changes in both document.

 

Out of sync

While editing the two documents may become out of sync. E.g. if you add new lines to one of the documents. This will disable some functions like "Copy section". To resolve the issue do a Re-Compare and the two documents will be synchronized again.

 

Save a patch file


You can save two different kinds of patch files.
 

1. The first one has the following layout:
 

-------------------------------------------------

[~] (line 4)

        margin: 11px 0;


 

[+] (line 5)

        text-decoration: none;

        color: white;    


 

[-] (line 15)

        padding:5px 12px;

        text-decoration: none;


 

[~] (line 20)

        margin: 8px 0;


 

[+] (line 21)

        color: white;      

-------------------------------------------------

Line 4:          The line has been modified and the new text is given below.

Line 5:          Two lines were added.

Line 15:          Two lines were removed.

...


 

2. The Unix patch file has the following layout:
 

-------------------------------------------------

4c4

<        margin: 12px 0;

---

>        margin: 11px 0;

4a5,6

>        text-decoration: none;

>        color: white;    

13,14d14

<        padding:5px 12px;

<        text-decoration: none;

20c20

<        margin: 8px 0;  

---

>        margin: 8px 0;

20a21

>        color: white;

-------------------------------------------------

c = changed, a = added, d = deleted


 

Here the patch file is telling you how to change the first file to make it match the second file. It is also displaying both the changed and new items.
 

4c4:                    Line 4 has to be changed to match line 4 in the second document.

4a5,6:          After line 4 in the first document you have to add the two lines given.

13,14d14:          You need to delete the two lines 13 and 14 in the first document so both documents will sync up at line 14.

...

 


 

 


 

 

 

 

Copyright © 2022 Rickard Johansson