Skip to content
pb-diff Help

Line Compare

Line Compare takes two lines and shows exactly what is different about them. Side by side, a change from > to >= or from ll_customer_id to ll_customer_no is easy to miss. Stacked and aligned, it is not.

Opening it

It opens as a tab like everything else. Compare ▸ Line Compare opens another tab rather than acting on the one in front, so two pairs of lines can sit side by side. Press F5 or the Compare button in the tool bar to compare the current contents of the two boxes.

The layout

The two input boxes are stacked, Old above New, and the result is below them. Both boxes are ordinary editable text, so a line can be typed, pasted or corrected in place. The splitter between the inputs and the result moves the space between them.

The tab itself holds nothing but those boxes. Its four controls are in the application's tool bar: the engine and language selectors, then Compare, which runs the comparison, and Swap, which exchanges Old and New. Each button shows its name, and its tool tip says what it does.

Reading the result

The two lines are shown one above the other, at the same left edge and in the editor font, so a run that was altered in place lands directly under the run it replaced. Runs that changed are shaded (the old line in the deleted colour, the new line in the added colour), and a marker at the left of each pair says what happened to it. Where one side has no line at all, only the other is shown.

The text is coloured by the language selector below, exactly as it is in a compare pane: keywords, strings, numbers and comments take the colours set under Options ▸ Appearance ▸ Syntax colours, including any set for that language alone. As elsewhere, change shading uses the background while the token class determines the text colour.

The status bar reports how many pairs were added, deleted and modified, or says that the two sides are identical.

It earns its place on a long line. PowerBuilder writes each DataWindow column as one statement on one physical line, often three hundred characters long, and a changed attribute in the middle of it is hard to find in a side-by-side pane. Select the column's line in a File Compare and press Ctrl+L: the two versions are stacked, and only the attribute that changed is shaded.

pb-diff Line Compare tab showing two versions of one long DataWindow column statement stacked one above the other, Old above New, with DataWindow syntax colouring. Only the format attribute is highlighted: the new version adds a red section for negative amounts. The tool bar offers the comparison method and the language.
The line_amount column statement of d_order_lines is one line of about three hundred characters. Line Compare stacks the old and new versions and marks only the changed display format. Select the image to view it at full size.

Compare engine

The first selector in the tool bar chooses how the line is broken up before comparison:

Engine Behaviour
Token by token Tokenises both lines in the selected language and compares whole tokens only. A token either matches or it does not, so ll_customer_id against ll_customer_no reads as one changed identifier rather than two changed characters inside a run of matching ones. Best for real code, and the default.
Character by character Compares individual characters, with look-ahead for runs that match. Best for a typo, a changed digit, a changed operator.

Token mode needs to know the language, so a language selector sits next to the engine one in the bar: PowerScript, DataWindow syntax, XML, HTML, JavaScript, INI, or plain text. When Line Compare is opened from a comparison, the language of that comparison is preselected.

More than one line

The boxes accept multi-line input. Paste a short block into each side if the change you are chasing spans two or three lines.