forked from aniani/vim
updated for version 7.3.281
Problem: After using "expand('%:8')" the buffer name is changed. Solution: Make a copy of the file name before shortening it.
This commit is contained in:
parent
c95e32635c
commit
dc93555c0f
24
src/eval.c
24
src/eval.c
@ -23205,6 +23205,7 @@ modify_fname(src, usedlen, fnamep, bufp, fnamelen)
|
|||||||
int c;
|
int c;
|
||||||
int has_fullname = 0;
|
int has_fullname = 0;
|
||||||
#ifdef WIN3264
|
#ifdef WIN3264
|
||||||
|
char_u *fname_start = *fnamep;
|
||||||
int has_shortname = 0;
|
int has_shortname = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -23379,24 +23380,25 @@ repeat:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN3264
|
#ifdef WIN3264
|
||||||
/* Check shortname after we have done 'heads' and before we do 'tails'
|
/*
|
||||||
|
* Handle ":8" after we have done 'heads' and before we do 'tails'.
|
||||||
*/
|
*/
|
||||||
if (has_shortname)
|
if (has_shortname)
|
||||||
{
|
{
|
||||||
pbuf = NULL;
|
/* Copy the string if it is shortened by :h and when it wasn't copied
|
||||||
/* Copy the string if it is shortened by :h */
|
* yet, because we are going to change it in place. Avoids changing
|
||||||
if (*fnamelen < (int)STRLEN(*fnamep))
|
* the buffer name for "%:8". */
|
||||||
|
if (*fnamelen < (int)STRLEN(*fnamep) || *fnamep == fname_start)
|
||||||
{
|
{
|
||||||
p = vim_strnsave(*fnamep, *fnamelen);
|
p = vim_strnsave(*fnamep, *fnamelen);
|
||||||
if (p == 0)
|
if (p == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
vim_free(*bufp);
|
vim_free(*bufp);
|
||||||
*bufp = *fnamep = p;
|
*bufp = *fnamep = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Split into two implementations - makes it easier. First is where
|
/* Split into two implementations - makes it easier. First is where
|
||||||
* there isn't a full name already, second is where there is.
|
* there isn't a full name already, second is where there is. */
|
||||||
*/
|
|
||||||
if (!has_fullname && !vim_isAbsName(*fnamep))
|
if (!has_fullname && !vim_isAbsName(*fnamep))
|
||||||
{
|
{
|
||||||
if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL)
|
if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL)
|
||||||
@ -23404,18 +23406,16 @@ repeat:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int l;
|
int l = *fnamelen;
|
||||||
|
|
||||||
/* Simple case, already have the full-name
|
/* Simple case, already have the full-name.
|
||||||
* Nearly always shorter, so try first time. */
|
* Nearly always shorter, so try first time. */
|
||||||
l = *fnamelen;
|
|
||||||
if (get_short_pathname(fnamep, bufp, &l) == FAIL)
|
if (get_short_pathname(fnamep, bufp, &l) == FAIL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (l == 0)
|
if (l == 0)
|
||||||
{
|
{
|
||||||
/* Couldn't find the filename.. search the paths.
|
/* Couldn't find the filename, search the paths. */
|
||||||
*/
|
|
||||||
l = *fnamelen;
|
l = *fnamelen;
|
||||||
if (shortpath_for_invalid_fname(fnamep, bufp, &l) == FAIL)
|
if (shortpath_for_invalid_fname(fnamep, bufp, &l) == FAIL)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -709,6 +709,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
281,
|
||||||
/**/
|
/**/
|
||||||
280,
|
280,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user