aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/undo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/undo.c')
-rw-r--r--src/nvim/undo.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 078cb6a210..8324db37c6 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -89,6 +89,7 @@
#include "nvim/change.h"
#include "nvim/cursor.h"
#include "nvim/edit.h"
+#include "nvim/ex_getln.h"
#include "nvim/extmark.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
@@ -297,7 +298,7 @@ bool undo_allowed(buf_T *buf)
// Don't allow changes in the buffer while editing the cmdline. The
// caller of getcmdline() may get confused.
if (textlock != 0) {
- emsg(_(e_secure));
+ emsg(_(e_textlock));
return false;
}
@@ -693,8 +694,7 @@ char *u_get_undo_file_name(const char *const buf_ffname, const bool reading)
// When not reading use the first directory that exists or ".".
dirp = (char *)p_udir;
while (*dirp != NUL) {
- size_t dir_len = copy_option_part((char_u **)&dirp, (char_u *)dir_name,
- MAXPATHL, ",");
+ size_t dir_len = copy_option_part(&dirp, dir_name, MAXPATHL, ",");
if (dir_len == 1 && dir_name[0] == '.') {
// Use same directory as the ffname,
// "dir/name" -> "dir/.name.un~"
@@ -1186,7 +1186,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
bufinfo_T bi;
if (name == NULL) {
- file_name = u_get_undo_file_name((char *)buf->b_ffname, false);
+ file_name = u_get_undo_file_name(buf->b_ffname, false);
if (file_name == NULL) {
if (p_verbose > 0) {
verbose_enter();
@@ -1291,7 +1291,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
FileInfo file_info_old;
FileInfo file_info_new;
if (buf->b_ffname != NULL
- && os_fileinfo((char *)buf->b_ffname, &file_info_old)
+ && os_fileinfo(buf->b_ffname, &file_info_old)
&& os_fileinfo(file_name, &file_info_new)
&& file_info_old.stat.st_gid != file_info_new.stat.st_gid
&& os_fchown(fd, (uv_uid_t)-1, (uv_gid_t)file_info_old.stat.st_gid)) {
@@ -1370,10 +1370,8 @@ write_error:
#ifdef HAVE_ACL
if (buf->b_ffname != NULL) {
- vim_acl_T acl;
-
// For systems that support ACL: get the ACL from the original file.
- acl = mch_get_acl(buf->b_ffname);
+ vim_acl_T acl = mch_get_acl((char_u *)buf->b_ffname);
mch_set_acl((char_u *)file_name, acl);
mch_free_acl(acl);
}
@@ -1398,7 +1396,7 @@ void u_read_undo(char *name, const char_u *hash, const char_u *orig_name FUNC_AT
char *file_name;
if (name == NULL) {
- file_name = u_get_undo_file_name((char *)curbuf->b_ffname, true);
+ file_name = u_get_undo_file_name(curbuf->b_ffname, true);
if (file_name == NULL) {
return;
}
@@ -1957,6 +1955,11 @@ void undo_time(long step, bool sec, bool file, bool absolute)
bool above = false;
bool did_undo = true;
+ if (text_locked()) {
+ text_locked_msg();
+ return;
+ }
+
// First make sure the current undoable change is synced.
if (curbuf->b_u_synced == false) {
u_sync(true);