diff: fix and improve detection of filename
commitc01f8bb27893c404beb578feff0b6ca7de59d42d
authorVivien Didelot <vivien@didelot.org>
Sat, 7 Jul 2012 04:47:01 +0000 (7 00:47 -0400)
committerJonas Fonseca <fonseca@diku.dk>
Fri, 10 Aug 2012 02:20:12 +0000 (9 22:20 -0400)
treebc92329efebe963d6b8badcbd05a33dd95ef3f8e
parent01630756f6458ee41555373510c7023f16ac306b
diff: fix and improve detection of filename

There were a few badly displayed filenames in the diff view:
in case of adding a new empty file, deleting, or copying a file,
the status line displays:

    Diff of '(null)'

This is because there is no diff for a copy or a new empty file,
and because the destination for a deletion is shown as /dev/null.

The code used to get the filename corresponding to the displayed changes
is extracted in its own function. It now retrieves the filename from the
diff header line, which is always present and a more reliable data.

This commit also adds the "deleted mode" line type for better coloring.

Signed-off-by: Vivien Didelot <vivien@didelot.org>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
tig.c