Context, whitespace and the minimap

How much unchanged code to show around a change, and the three toggles beside it.

Four controls in the diff header change how a change is drawn. None of them alters the change itself.

Context

A diff shows the changed lines plus some unchanged lines around them, so you can tell where you are. How many is adjustable, from a few lines up to the whole file.

It is worth more than it sounds. Three lines of context is enough to see that a line changed and rarely enough to see whether it changed correctly — the function it is in may start twenty lines above. Widening the context to the whole file turns a diff into the file, with the changes marked in it.

Context also decides where hunks begin and end: widening it can merge two adjacent hunks into one, and narrowing it can split one into two. If you are staging by hunk, that is a lever, not a side effect.

Whitespace markers

The toggle draws spaces, tabs and line endings. Off by default, because it makes ordinary code noisier; indispensable the moment a diff appears to change a line that looks identical.

The minimap

The map toggle draws a condensed picture of the whole file beside the diff, with the changed regions marked. On a long file it is the fastest way to see how many separate changes there are and roughly where.

Wrapping long lines

The Wrap long lines toggle folds a line too long for the column onto as many rows as it needs, instead of leaving it to run off the right-hand edge. Off by default, and the choice is global: it is kept for every diff you open next, and across launches.

It changes the layout and not the text. A folded line keeps its one line number and its one staging target, and copying or searching it gives back the single line the file holds.