Browse: git problem in rendering file list.

Now that we display the last keystroke at the very end of the
first line it is wrong to 'clrtoeol' afterwards as that will
clear the next line.

So remove that, make sure we clear the spaces before the number
incase it becomes shorter, and tidy up the display for 'ESC...' too.

Reported-by: Manpreet Singh <junkblocker@yahoo.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Browse: ensure we erase all of old type name when updating position data.

Top-right of the merge window identifies the current location in
the merge.  It is variable length and right justified, so we need to make
sure we erase start of old value before writing new value.
Old code only allowed for a difference of three which didn't cope
with, for example, change from AlreadyApplied to Changed.
So be more thorough.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: remove CHANGED

The 'CHANGED' flag is unused, so discard it to avoid confusion.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: revise the exact meaning of 'CHANGES'.

The 'CHANGES' flag now means that a change is visible at this point
in the merge.  i.e. two streams need to be displayed instead of just one.

In particular, this means that an AlreadyApplied line removal will not
appear at all in the 'merge' window, but will trigger the 'diff' subwindow
to be displayed.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: ensure searching for 'next change' works.

Now that AlreadyApplied may not cause multiple streams  in the
merge window, we need to be more carefuly about searching for changes.
i.e. we need to check each line to see if it is at-or-near an
interesting change.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: fix check_line to stop at hunk headers.

check_line() includes invisible bits because they could in some sense
be part of 'this' line.  It ignore hunk headers, but it really should stop
at them, because nothing before could be related to this line.

This fixes a problem where 'N' and 'P' would find hunk headers
which isn't really helpful.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: make ctrl-G search-again-forward, not just search-again.

As ctrl-S doesn't work (as I haven't enabled 'raw' mode), you cannot
search forward during a reverse search.  So change ctrl-G to do that
rather than search-again-in-current-direction, which isn't really useful.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: highlight spaces when they might be important.

If a wiggle is needed due to white-space issues, it is good
to show them.
So in cases where that might be happening - unmatches space or
extraneous space - highlight spaces as inverse-video and tabs as
underlines.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: add 'space' and 'backspace' for page up/down.

Makes movement a bit easier.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: avoid extra blanks when cursor is in alternate pane.

When cursor is in the 'diff' pane of the 'merge' view, the line it is
on might not be visible in the main pane.  This can cause ugly a_void
lines to appear.
So make sure there point we refresh is a visible point.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: change args to visible()

The type and stream passed to visible() are always generate from
a merge and an mpos in the same way.  So pass the merge and mpos
instead.
This makes more information available to visible() which will be used
in a future patch.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: allow conflict to be ignored with 'x'

Patch still under development
vpatch: allow a file in list to be a 'merger' instead of a patched file.

This will be useful once we can save files - the result of a save is
a merger.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: remove lots of memory leaks.

Thanks for valgrind for making it easy to find these.

Signed-off-by: NeilBrown <neilb@suse.de>
Separate make_merger out from print_merge2

Will want to print a 'merger' that we have modified.  So don't
call make_merger from print_merge, call it before hand and pass it in.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: Allow a message to be displayed in main folder.

So when we act on a file, it won't be invisible.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: support saving of files.

'S' will save the current file.  If you try to enter
it again, it will be loaded as a 'merge'.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: allow a save file to be restored.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: prompt to save change if merge was editted.

Not much editting is possible yet, but if it is done, we might
want to save, or discard, or continue editing.

The 'help' window is retasked to alternatively be a 'query' window.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch: avoid repeated backups.

If we have already saved a merge, taking a backup, then don't take further
backups - pointless and possibly distructive.

Signed-off-by: NeilBrown <neilb@suse.de>