Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Vim
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Someone-Else
Vim
Commits
6a244fef
Commit
6a244fef
authored
14 years ago
by
Bram Moolenaar
Browse files
Options
Downloads
Patches
Plain Diff
Fix: :wundo didn't work in a buffer without a name.
parent
442b4225
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
runtime/doc/options.txt
+5
-2
5 additions, 2 deletions
runtime/doc/options.txt
src/undo.c
+25
-12
25 additions, 12 deletions
src/undo.c
with
30 additions
and
14 deletions
runtime/doc/options.txt
+
5
−
2
View file @
6a244fef
...
...
@@ -7226,8 +7226,11 @@ A jump table for the options with a short description can be found at |Q_op|.
{not in Vi}
{only when compiled with the +persistent_undo feature}
List of directory names for undo files, separated with commas.
See |'backupdir'| for the format. Specifically, "." means using the
directory of the file.
See |'backupdir'| for the format.
"." means using the directory of the file. The undo file name for
"file.txt" is ".file.txt.un~".
For other directories the file name is the full path of the edited
file, with path separators replaced with "%".
When writing: The first directory that exists is used. "." always
works, no directories after "." will be used for writing.
When reading all entries are tried to find an undo file. The first
...
...
This diff is collapsed.
Click to expand it.
src/undo.c
+
25
−
12
View file @
6a244fef
...
...
@@ -1233,6 +1233,7 @@ u_write_undo(name, forceit, buf, hash)
int
perm
;
int
write_ok
=
FALSE
;
#ifdef UNIX
int
st_old_valid
=
FALSE
;
struct
stat
st_old
;
struct
stat
st_new
;
#endif
...
...
@@ -1246,16 +1247,25 @@ u_write_undo(name, forceit, buf, hash)
else
file_name
=
name
;
#ifdef UNIX
if
(
mch_stat
((
char
*
)
buf
->
b_ffname
,
&
st_old
)
>=
0
)
perm
=
st_old
.
st_mode
;
else
if
(
buf
->
b_ffname
==
NULL
)
perm
=
0600
;
else
{
#ifdef UNIX
if
(
mch_stat
((
char
*
)
buf
->
b_ffname
,
&
st_old
)
>=
0
)
{
perm
=
st_old
.
st_mode
;
st_old_valid
=
TRUE
;
}
else
perm
=
0600
;
#else
perm
=
mch_getperm
(
buf
->
b_ffname
);
if
(
perm
<
0
)
perm
=
0600
;
perm
=
mch_getperm
(
buf
->
b_ffname
);
if
(
perm
<
0
)
perm
=
0600
;
#endif
}
/* set file protection same as original file, but strip s-bit */
perm
=
perm
&
0777
;
...
...
@@ -1309,15 +1319,16 @@ u_write_undo(name, forceit, buf, hash)
* this fails, set the protection bits for the group same as the
* protection bits for others.
*/
if
(
mch_stat
((
char
*
)
file_name
,
&
st_new
)
>=
0
&&
st_new
.
st_gid
!=
st_old
.
st_gid
if
(
st_old_valid
&&
(
mch_stat
((
char
*
)
file_name
,
&
st_new
)
>=
0
&&
st_new
.
st_gid
!=
st_old
.
st_gid
# ifdef HAVE_FCHOWN
/* sequent-ptx lacks fchown() */
&&
fchown
(
fd
,
(
uid_t
)
-
1
,
st_old
.
st_gid
)
!=
0
&&
fchown
(
fd
,
(
uid_t
)
-
1
,
st_old
.
st_gid
)
!=
0
)
# endif
)
mch_setperm
(
file_name
,
(
perm
&
0707
)
|
((
perm
&
07
)
<<
3
));
# ifdef HAVE_SELINUX
mch_copy_sec
(
buf
->
b_ffname
,
file_name
);
if
(
buf
->
b_ffname
!=
NULL
)
mch_copy_sec
(
buf
->
b_ffname
,
file_name
);
# endif
#endif
...
...
@@ -1438,9 +1449,11 @@ write_error:
EMSG2
(
_
(
"E829: write error in undo file: %s"
),
file_name
);
#if defined(MACOS_CLASSIC) || defined(WIN3264)
(
void
)
mch_copy_file_attribute
(
buf
->
b_ffname
,
file_name
);
if
(
buf
->
b_ffname
!=
NULL
)
(
void
)
mch_copy_file_attribute
(
buf
->
b_ffname
,
file_name
);
#endif
#ifdef HAVE_ACL
if
(
buf
->
b_ffname
!=
NULL
)
{
vim_acl_T
acl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment