English | 日本語
Home > Merge > Merge for Windows > Documentation Contents > Comparing Text Files (or Typed/Pasted Text)

Comparing Text Files (or Typed/Pasted Text)

Merge text comparisons make it possible for you to compare and merge text files, or text that you type into Merge. You can also copy and paste text directly from another application, making it easy to, for example, compare text from Microsoft Word files or PDF documents.

You can open a new text comparison window by clicking the New File Comparison toolbar button button in the toolbar, or by selecting the New Text Comparison command in the File menu.

A new file comparison window

Two empty areas where the compared files will be displayed take up the majority of the window. You can type or paste text directly into each file pane. Alternatively, above each file pane is an entry field that you can use to enter the path to a file that you want to compare.

To compare two files, you can type the paths of two files into the entry fields or use the buttons on the right-hand end of the entry fields to choose files to compare. The Browse button button opens a file-browsing window and the Drop-down list button button displays a drop-down list of files that you have recently compared. If you hold down the Ctrl key when selecting a file from the drop-down list, Merge will fill the filename fields for the other file panels with their corresponding historical values.

Click the Start/Recompare toolbar button button in the toolbar or press the Enter key when you have chosen two files to compare.

You can also drag and drop files from Windows Explorer onto the filename entry fields or onto the file panes.

Unicode/MBCS character encodings and code pages

Merge can compare files encoded with Unicode or mbcs character encodings as well as ascii files. For mbcs files, Merge can compare files even if they were saved using a codepage different to your default codepage. Please see Working with Character Encodings for more information.

The file comparison display

Two sample text files (test1.txt and test2.txt) are provided in the Merge installation directory. The following screenshot shows the results of a file comparison between these two files.

Results of comparing test1.txt and test2.txt

Changes between the two files are highlighted with colours and linking lines. Linking lines in the centre panel of the file comparison window connect related changes to show exactly how the files are related. You can modify the colours and fonts used in the file comparison window by using the controls in the Fonts and Colours options page.

A summary of the number of changes that were found between the compared files is shown in the status bar at the bottom of the main Merge application window. The current line and column number for the editing caret is also displayed.

Change summary

You can use the Split commands Two-Way Comparison (Horizontal) toolbar button and Two-Way Comparison (Vertical) toolbar button (or F11 and F12) in the Window menu to change the layout of the files within the file comparison window so that the compared files are displayed one above the other or side-by-side (the default).

There are many options that you can set to customize how Merge compares and displays files. There are help topics that will enable you learn how to customize Merge so that it produces the best results for you.

Navigation

As you scroll one file up and down using its scroll bar, the other file is scrolled so that the two files remain aligned in the centre of the display. The centre point marker (a line of small indentations in the centre of the linking lines panel) indicates the point at which Merge tries to keep related parts of the files aligned. You can temporarily prevent Merge from keeping both files aligned by holding down the Ctrl key whilst scrolling. When you release Ctrl, the files will snap back into alignment.

The small Previous Change and Next Change buttons Previous/Next Change buttons below the scroll bars can be used to jump to the previous or next change.

Overview strip There are thin overview strips next to the vertical scroll bars at the left and right edges of the file comparison window. These contain markings to indicate the position of changes within the compared files. You can quickly navigate to a change by clicking on the marks in the strip.

You can use the cursor keys to navigate within a file after clicking within it to give it keyboard focus. The following navigation shortcut keys are also available:

For a full list of keyboard shortcuts, see File Comparison Keyboard Shortcuts.

Mouse navigation

Merge supports mice with wheels. If you have a three-button mouse, you can click within a file panel with the middle mouse button to enter a panning mode. The file will scroll in the direction you move the mouse. To stop panning, click the middle mouse button again. If your mouse has a wheel, you can use it to scroll up and down within the active file. If your mouse or keyboard has backwards and forwards buttons, you can use them to navigate to the previous or next change.

Searching for text

You can search for text in the active file by pressing Ctrl+F or selecting the Find... command from the Edit menu.

Switching between multiple file comparisons

Merge allows you to work with multiple file comparisons open at the same time. A tab strip along the bottom of the main file comparison window allows you to switch between file comparisons with a single mouse click.

Bookmarks and comments

As you are comparing or editing files, you might want to set bookmarks to enable you to return to locations of interest later on. Press Ctrl+F2 to toggle a bookmark on or off on the current line. To navigate between bookmarks, press F2 or Shift+F2.

Comments can be added to bookmarks, making it easy to note important information or to record a question. To edit a bookmark’s comment, right-click the bookmark and choose the Edit Comment menu item. Bookmark comments are shown as tooltips when you hover the mouse pointer over a bookmark.

Bookmarks and comments are included when you save a comparison for archival or team collaboration. They are therefore a useful tool for asking questions or making notes in a comparison that will later be emailed to other team members for review.

Three-way file comparisons

In addition to two-way file comparison, the Professional Edition of Merge enables you compare and merge three files. Please see the Three-Way File Comparisons topic for more information.

Editing files

In addition to the comparison features described above, Merge enables you to edit and merge the files being compared. Please see the Editing Files topic for more information.

Syntax Highlighting

Merge provides syntax colouring support for a variety of programming languages:

Language File extensions
C/C++/Obj-C .c .cc .cpp .cxx .h .hh .hpp .hxx .sma .m .mm
C# .cs
D .d
Windows resources .rc .rc2 .dlg
IDL .idl .odl
Flash .as .asc .jsfl
Java .java
JavaScript .js
VB .vb .bas .frm .cls .ctl .pag .dsr .dob
VBScript .vbs .dsm
Pascal/Delphi .dpr .dpk .pas .dfm .inc .pp
HTML/XML/PHP/VXML .html .htm .asp .shtml .htd .php3 .phtml .php .htt .cfm .tpl .dtd .hta .vxml .xml .xsl .xslt .svg .xul .xsd .dtd .axl .xrc .rdf .vcproj .wxs .wxi .docbook
CSS .css
Caml/OCaml/F#/SML .caml .ml .mli .fs .fsi
Erlang .erl .hrl
Fortran .f90 .f95 .f2k .f .for
Lisp .lsp .lisp .csm .smd .ss
Perl .pl .pm .cgi .pod
Python .py .pyw SConstruct SConscript
Ruby .rb .rbw
Smalltalk .st .pac
SQL .sql .spec .body .sps .spb .sf .sp

Syntax highlighting can be enabled (and colours configured) using the controls in the Syntax Highlighting options page. File extensions and keywords for each language can be changed by editing the highlight.styles file in the Merge installation directory.