summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2007-06-19 13:36:52 +0000
committerBram Moolenaar <Bram@vim.org>2007-06-19 13:36:52 +0000
commit512e6b838a1576ac3fc3fba5f6ff2ba25864d511 (patch)
tree985ca97b2dad1350ed0123e60f2f0dc15b997993 /src/buffer.c
parent1864a4e0fd303ac2cb199df6993747a3a1f5a7b1 (diff)
updated for version 7.1-006v7.1.006
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 14b64c8eea..8bd3a35533 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -171,6 +171,13 @@ open_buffer(read_stdin, eap)
/* Put the cursor on the first line. */
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
+
+ /* Set or reset 'modified' before executing autocommands, so that
+ * it can be changed there. */
+ if (!readonlymode && !bufempty())
+ changed();
+ else if (retval != FAIL)
+ unchanged(curbuf, FALSE);
#ifdef FEAT_AUTOCMD
# ifdef FEAT_EVAL
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
@@ -194,16 +201,16 @@ open_buffer(read_stdin, eap)
/* When reading stdin, the buffer contents always needs writing, so set
* the changed flag. Unless in readonly mode: "ls | gview -".
* When interrupted and 'cpoptions' contains 'i' set changed flag. */
- if ((read_stdin && !readonlymode && !bufempty())
+ if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
#ifdef FEAT_AUTOCMD
|| modified_was_set /* ":set modified" used in autocmd */
# ifdef FEAT_EVAL
|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
# endif
#endif
- || (got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL))
+ )
changed();
- else if (retval != FAIL)
+ else if (retval != FAIL && !read_stdin)
unchanged(curbuf, FALSE);
save_file_ff(curbuf); /* keep this fileformat */