> The following substitutes '~' for $HOME in the \W prompt case, taken
> from \w. This matches bash's behavior for \W.
This has bugged me too, and I have a very similar patch in my tree. The
exception is the middle conditional.
> + } else if (strncmp(p, str_val(global("HOME")),
> n)
> + == 0 && p[n] == '/') {
> + snprintf(strbuf, sizeof strbuf, "~/%s",
> + str_val(global("PWD")) + n + 1);
> + } else
This doesn't belong there. This effective turns \W into \w if the path
is somewhere in the user's home directory. Without that conditional, it
matches bash.