Show relative paths in diff filename tags.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3951 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
a6a847f4e7
commit
746a8d5834
@ -5,6 +5,8 @@
|
||||
scrolling with the arrow keys.
|
||||
* src/keybindings.c, src/keybindings.h, src/search.c, src/search.h:
|
||||
Add 'Mark All' keybinding.
|
||||
* tagmanager/diff.c:
|
||||
Show relative paths in diff filename tags.
|
||||
|
||||
|
||||
2009-07-09 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||
|
@ -24,11 +24,11 @@
|
||||
* DATA DEFINITIONS
|
||||
*/
|
||||
typedef enum {
|
||||
K_FUNCTION
|
||||
K_FUNCTION
|
||||
} diffKind;
|
||||
|
||||
static kindOption DiffKinds [] = {
|
||||
{ TRUE, 'f', "function", "functions"}
|
||||
{ TRUE, 'f', "function", "functions"}
|
||||
};
|
||||
|
||||
/*
|
||||
@ -37,32 +37,40 @@ static kindOption DiffKinds [] = {
|
||||
|
||||
static void findDiffTags (void)
|
||||
{
|
||||
vString *filename = vStringNew ();
|
||||
const unsigned char *line, *tmp;
|
||||
vString *filename = vStringNew ();
|
||||
const unsigned char *line, *tmp;
|
||||
|
||||
while ((line = fileReadLine ()) != NULL)
|
||||
{
|
||||
while ((line = fileReadLine ()) != NULL)
|
||||
{
|
||||
const unsigned char* cp = line;
|
||||
boolean skipSlash = TRUE;
|
||||
boolean skipSlash = FALSE;
|
||||
|
||||
if (strncmp((const char*) cp, "--- ", (size_t) 4) == 0)
|
||||
{
|
||||
cp += 4;
|
||||
if (isspace ((int) *cp)) continue;
|
||||
|
||||
tmp = (const unsigned char*) strrchr((const char*) cp, '/');
|
||||
if (tmp == NULL)
|
||||
{ /* if no / is contained try \ in case of a Windows filename */
|
||||
tmp = (const unsigned char*) strrchr((const char*) cp, '\\');
|
||||
/* strip any absolute path */
|
||||
if (*cp == '/' || *cp == '\\')
|
||||
{
|
||||
skipSlash = TRUE;
|
||||
tmp = (const unsigned char*) strrchr((const char*) cp, '/');
|
||||
if (tmp == NULL)
|
||||
{ /* last fallback, probably the filename doesn't contain a path, so take it */
|
||||
if (strlen((const char*) cp) > 0)
|
||||
{
|
||||
tmp = cp;
|
||||
skipSlash = FALSE;
|
||||
{ /* if no / is contained try \ in case of a Windows filename */
|
||||
tmp = (const unsigned char*) strrchr((const char*) cp, '\\');
|
||||
if (tmp == NULL)
|
||||
{ /* last fallback, probably the filename doesn't contain a path, so take it */
|
||||
if (strlen((const char*) cp) > 0)
|
||||
{
|
||||
tmp = cp;
|
||||
skipSlash = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
tmp = cp;
|
||||
|
||||
if (tmp != NULL)
|
||||
{
|
||||
if (skipSlash) tmp++; /* skip the leading slash or backslash */
|
||||
@ -77,20 +85,20 @@ static void findDiffTags (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
vStringDelete (filename);
|
||||
vStringDelete (filename);
|
||||
}
|
||||
|
||||
extern parserDefinition* DiffParser (void)
|
||||
{
|
||||
static const char *const patterns [] = { "*.diff", "*.patch", NULL };
|
||||
static const char *const extensions [] = { "diff", NULL };
|
||||
parserDefinition* const def = parserNew ("Diff");
|
||||
def->kinds = DiffKinds;
|
||||
def->kindCount = KIND_COUNT (DiffKinds);
|
||||
def->patterns = patterns;
|
||||
def->extensions = extensions;
|
||||
def->parser = findDiffTags;
|
||||
return def;
|
||||
static const char *const patterns [] = { "*.diff", "*.patch", NULL };
|
||||
static const char *const extensions [] = { "diff", NULL };
|
||||
parserDefinition* const def = parserNew ("Diff");
|
||||
def->kinds = DiffKinds;
|
||||
def->kindCount = KIND_COUNT (DiffKinds);
|
||||
def->patterns = patterns;
|
||||
def->extensions = extensions;
|
||||
def->parser = findDiffTags;
|
||||
return def;
|
||||
}
|
||||
|
||||
/* vi:set tabstop=8 shiftwidth=4: */
|
||||
|
Loading…
x
Reference in New Issue
Block a user