mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 20:18:32 +00:00
@@ -8543,7 +8543,9 @@ static void ex_loadview(exarg_T *eap)
|
|||||||
|
|
||||||
fname = get_view_file(*eap->arg);
|
fname = get_view_file(*eap->arg);
|
||||||
if (fname != NULL) {
|
if (fname != NULL) {
|
||||||
do_source(fname, FALSE, DOSO_NONE);
|
if (do_source(fname, FALSE, DOSO_NONE) == FAIL) {
|
||||||
|
EMSG2(_(e_notopen), fname);
|
||||||
|
}
|
||||||
free(fname);
|
free(fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2839,27 +2839,25 @@ buf_write (
|
|||||||
* Check if backup file already exists.
|
* Check if backup file already exists.
|
||||||
*/
|
*/
|
||||||
if (os_fileinfo((char *)backup, &file_info_new)) {
|
if (os_fileinfo((char *)backup, &file_info_new)) {
|
||||||
/*
|
|
||||||
* Check if backup file is same as original file.
|
|
||||||
* May happen when modname() gave the same file back (e.g. silly
|
|
||||||
* link). If we don't check here, we either ruin the file when
|
|
||||||
* copying or erase it after writing.
|
|
||||||
*/
|
|
||||||
if (os_fileinfo_id_equal(&file_info_new, &file_info_old)) {
|
if (os_fileinfo_id_equal(&file_info_new, &file_info_old)) {
|
||||||
|
/*
|
||||||
|
* Backup file is same as original file.
|
||||||
|
* May happen when modname() gave the same file back (e.g. silly
|
||||||
|
* link). If we don't check here, we either ruin the file when
|
||||||
|
* copying or erase it after writing.
|
||||||
|
*/
|
||||||
free(backup);
|
free(backup);
|
||||||
backup = NULL; /* no backup file to delete */
|
backup = NULL; /* no backup file to delete */
|
||||||
}
|
} else if (!p_bk) {
|
||||||
|
/*
|
||||||
/*
|
* We are not going to keep the backup file, so don't
|
||||||
* If we are not going to keep the backup file, don't
|
* delete an existing one, and try to use another name instead.
|
||||||
* delete an existing one, try to use another name.
|
* Change one character, just before the extension.
|
||||||
* Change one character, just before the extension.
|
*/
|
||||||
*/
|
wp = backup + STRLEN(backup) - 1 - STRLEN(backup_ext);
|
||||||
if (!p_bk) {
|
if (wp < backup) { /* empty file name ??? */
|
||||||
wp = backup + STRLEN(backup) - 1
|
|
||||||
- STRLEN(backup_ext);
|
|
||||||
if (wp < backup) /* empty file name ??? */
|
|
||||||
wp = backup;
|
wp = backup;
|
||||||
|
}
|
||||||
*wp = 'z';
|
*wp = 'z';
|
||||||
while (*wp > 'a'
|
while (*wp > 'a'
|
||||||
&& os_fileinfo((char *)backup, &file_info_new)) {
|
&& os_fileinfo((char *)backup, &file_info_new)) {
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "nvim/fold.h"
|
#include "nvim/fold.h"
|
||||||
#include "nvim/getchar.h"
|
#include "nvim/getchar.h"
|
||||||
#include "nvim/indent.h"
|
#include "nvim/indent.h"
|
||||||
|
#include "nvim/log.h"
|
||||||
#include "nvim/mark.h"
|
#include "nvim/mark.h"
|
||||||
#include "nvim/mbyte.h"
|
#include "nvim/mbyte.h"
|
||||||
#include "nvim/memline.h"
|
#include "nvim/memline.h"
|
||||||
@@ -2641,7 +2642,10 @@ do_put (
|
|||||||
|
|
||||||
/* Autocommands may be executed when saving lines for undo, which may make
|
/* Autocommands may be executed when saving lines for undo, which may make
|
||||||
* y_array invalid. Start undo now to avoid that. */
|
* y_array invalid. Start undo now to avoid that. */
|
||||||
u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1);
|
if (u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1) == FAIL) {
|
||||||
|
ELOG(_("Failed to save undo information"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (insert_string != NULL) {
|
if (insert_string != NULL) {
|
||||||
y_type = MCHAR;
|
y_type = MCHAR;
|
||||||
|
@@ -230,7 +230,7 @@ int u_save(linenr_T top, linenr_T bot)
|
|||||||
if (top > curbuf->b_ml.ml_line_count
|
if (top > curbuf->b_ml.ml_line_count
|
||||||
|| top >= bot
|
|| top >= bot
|
||||||
|| bot > curbuf->b_ml.ml_line_count + 1)
|
|| bot > curbuf->b_ml.ml_line_count + 1)
|
||||||
return FALSE; /* rely on caller to do error messages */
|
return FAIL; /* rely on caller to do error messages */
|
||||||
|
|
||||||
if (top + 2 == bot)
|
if (top + 2 == bot)
|
||||||
u_saveline((linenr_T)(top + 1));
|
u_saveline((linenr_T)(top + 1));
|
||||||
|
Reference in New Issue
Block a user