]>
Commit | Line | Data |
---|---|---|
ad28a8ff AG |
1 | To: vim-dev@vim.org |
2 | Subject: patch 7.1.006 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.006 | |
11 | Problem: Resetting 'modified' in a StdinReadPost autocommand doesn't work. | |
12 | Solution: Set 'modified' before the autocommands instead of after it. | |
13 | Files: src/buffer.c | |
14 | ||
15 | ||
16 | *** ../vim-7.1.005/src/buffer.c Thu May 10 18:43:46 2007 | |
17 | --- src/buffer.c Fri Jun 8 20:59:04 2007 | |
18 | *************** | |
19 | *** 171,176 **** | |
20 | --- 171,183 ---- | |
21 | /* Put the cursor on the first line. */ | |
22 | curwin->w_cursor.lnum = 1; | |
23 | curwin->w_cursor.col = 0; | |
24 | + | |
25 | + /* Set or reset 'modified' before executing autocommands, so that | |
26 | + * it can be changed there. */ | |
27 | + if (!readonlymode && !bufempty()) | |
28 | + changed(); | |
29 | + else if (retval != FAIL) | |
30 | + unchanged(curbuf, FALSE); | |
31 | #ifdef FEAT_AUTOCMD | |
32 | # ifdef FEAT_EVAL | |
33 | apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE, | |
34 | *************** | |
35 | *** 194,209 **** | |
36 | /* When reading stdin, the buffer contents always needs writing, so set | |
37 | * the changed flag. Unless in readonly mode: "ls | gview -". | |
38 | * When interrupted and 'cpoptions' contains 'i' set changed flag. */ | |
39 | ! if ((read_stdin && !readonlymode && !bufempty()) | |
40 | #ifdef FEAT_AUTOCMD | |
41 | || modified_was_set /* ":set modified" used in autocmd */ | |
42 | # ifdef FEAT_EVAL | |
43 | || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) | |
44 | # endif | |
45 | #endif | |
46 | ! || (got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL)) | |
47 | changed(); | |
48 | ! else if (retval != FAIL) | |
49 | unchanged(curbuf, FALSE); | |
50 | save_file_ff(curbuf); /* keep this fileformat */ | |
51 | ||
52 | --- 201,216 ---- | |
53 | /* When reading stdin, the buffer contents always needs writing, so set | |
54 | * the changed flag. Unless in readonly mode: "ls | gview -". | |
55 | * When interrupted and 'cpoptions' contains 'i' set changed flag. */ | |
56 | ! if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) | |
57 | #ifdef FEAT_AUTOCMD | |
58 | || modified_was_set /* ":set modified" used in autocmd */ | |
59 | # ifdef FEAT_EVAL | |
60 | || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) | |
61 | # endif | |
62 | #endif | |
63 | ! ) | |
64 | changed(); | |
65 | ! else if (retval != FAIL && !read_stdin) | |
66 | unchanged(curbuf, FALSE); | |
67 | save_file_ff(curbuf); /* keep this fileformat */ | |
68 | ||
69 | *** ../vim-7.1.005/src/version.c Tue Jun 19 12:58:55 2007 | |
70 | --- src/version.c Tue Jun 19 15:37:53 2007 | |
71 | *************** | |
72 | *** 668,669 **** | |
73 | --- 668,671 ---- | |
74 | { /* Add new patch number below this line */ | |
75 | + /**/ | |
76 | + 6, | |
77 | /**/ | |
78 | ||
79 | -- | |
80 | If I tell you "you have a beautiful body", would you hold it against me? | |
81 | ||
82 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
83 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
84 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
85 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |