Skip to content

Commit

Permalink
Enable tilde expansion for diff-highlight
Browse files Browse the repository at this point in the history
Closes jonas#1107
  • Loading branch information
koutcher committed May 21, 2021
1 parent 173b941 commit 4575daf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,22 @@ app_git_exec_path(char *path, size_t path_len)
static bool
app_diff_highlight_path_search(char *dest, size_t destlen, const char *query)
{
const char *env_path = getenv("PATH");
char env_path_plus[SIZEOF_MED_STR];
char exec_path[SIZEOF_STR];

if (!query || !*query)
return false;

if (strchr(query, '~'))
return path_expand(dest, destlen, query);

if (strchr(query, '/')) {
/* can only be interpreted as a fully qualified path */
string_ncopy_do(dest, destlen, query, strlen(query));
return true;
}

const char *env_path = getenv("PATH");
char env_path_plus[SIZEOF_MED_STR];
char exec_path[SIZEOF_STR];

if (!env_path || !*env_path)
env_path = _PATH_DEFPATH;

Expand Down

0 comments on commit 4575daf

Please sign in to comment.