Mercurial > vim
comparison src/fileio.c @ 1201:4d2585cf5950
updated for version 7.1b
author | vimboss |
---|---|
date | Thu, 10 May 2007 17:35:54 +0000 |
parents | f0dcee927c1d |
children | da0991871b02 |
comparison
equal
deleted
inserted
replaced
1200:f58cb9bf1260 | 1201:4d2585cf5950 |
---|---|
1269 error = TRUE; | 1269 error = TRUE; |
1270 #ifdef FEAT_MBYTE | 1270 #ifdef FEAT_MBYTE |
1271 else if (conv_restlen > 0) | 1271 else if (conv_restlen > 0) |
1272 { | 1272 { |
1273 /* Reached end-of-file but some trailing bytes could | 1273 /* Reached end-of-file but some trailing bytes could |
1274 * not be converted. Trucated file? */ | 1274 * not be converted. Truncated file? */ |
1275 if (conv_error == 0) | 1275 if (conv_error == 0) |
1276 conv_error = linecnt; | 1276 conv_error = linecnt; |
1277 if (bad_char_behavior != BAD_DROP) | 1277 if (bad_char_behavior != BAD_DROP) |
1278 { | 1278 { |
1279 fio_flags = 0; /* don't convert this */ | 1279 fio_flags = 0; /* don't convert this */ |
2190 } | 2190 } |
2191 linecnt = curbuf->b_ml.ml_line_count - linecnt; | 2191 linecnt = curbuf->b_ml.ml_line_count - linecnt; |
2192 if (filesize == 0) | 2192 if (filesize == 0) |
2193 linecnt = 0; | 2193 linecnt = 0; |
2194 if (newfile || read_buffer) | 2194 if (newfile || read_buffer) |
2195 { | |
2195 redraw_curbuf_later(NOT_VALID); | 2196 redraw_curbuf_later(NOT_VALID); |
2197 #ifdef FEAT_DIFF | |
2198 /* After reading the text into the buffer the diff info needs to | |
2199 * be updated. */ | |
2200 diff_invalidate(curbuf); | |
2201 #endif | |
2202 #ifdef FEAT_FOLDING | |
2203 /* All folds in the window are invalid now. Mark them for update | |
2204 * before triggering autocommands. */ | |
2205 foldUpdateAll(curwin); | |
2206 #endif | |
2207 } | |
2196 else if (linecnt) /* appended at least one line */ | 2208 else if (linecnt) /* appended at least one line */ |
2197 appended_lines_mark(from, linecnt); | 2209 appended_lines_mark(from, linecnt); |
2198 | 2210 |
2199 #ifdef FEAT_DIFF | |
2200 /* After reading the text into the buffer the diff info needs to be | |
2201 * updated. */ | |
2202 if (newfile || read_buffer) | |
2203 diff_invalidate(curbuf); | |
2204 #endif | |
2205 #ifndef ALWAYS_USE_GUI | 2211 #ifndef ALWAYS_USE_GUI |
2206 /* | 2212 /* |
2207 * If we were reading from the same terminal as where messages go, | 2213 * If we were reading from the same terminal as where messages go, |
2208 * the screen will have been messed up. | 2214 * the screen will have been messed up. |
2209 * Switch on raw mode now and clear the screen. | 2215 * Switch on raw mode now and clear the screen. |
4024 | 4030 |
4025 #if defined(MACOS_CLASSIC) || defined(WIN3264) | 4031 #if defined(MACOS_CLASSIC) || defined(WIN3264) |
4026 /* TODO: Is it need for MACOS_X? (Dany) */ | 4032 /* TODO: Is it need for MACOS_X? (Dany) */ |
4027 /* | 4033 /* |
4028 * On macintosh copy the original files attributes (i.e. the backup) | 4034 * On macintosh copy the original files attributes (i.e. the backup) |
4029 * This is done in order to preserve the ressource fork and the | 4035 * This is done in order to preserve the resource fork and the |
4030 * Finder attribute (label, comments, custom icons, file creatore) | 4036 * Finder attribute (label, comments, custom icons, file creator) |
4031 */ | 4037 */ |
4032 if (backup != NULL && overwriting && !append) | 4038 if (backup != NULL && overwriting && !append) |
4033 { | 4039 { |
4034 if (backup_copy) | 4040 if (backup_copy) |
4035 (void)mch_copy_file_attribute(wfname, backup); | 4041 (void)mch_copy_file_attribute(wfname, backup); |
4039 | 4045 |
4040 if (!overwriting && !append) | 4046 if (!overwriting && !append) |
4041 { | 4047 { |
4042 if (buf->b_ffname != NULL) | 4048 if (buf->b_ffname != NULL) |
4043 (void)mch_copy_file_attribute(buf->b_ffname, wfname); | 4049 (void)mch_copy_file_attribute(buf->b_ffname, wfname); |
4044 /* Should copy ressource fork */ | 4050 /* Should copy resource fork */ |
4045 } | 4051 } |
4046 #endif | 4052 #endif |
4047 | 4053 |
4048 write_info.bw_fd = fd; | 4054 write_info.bw_fd = fd; |
4049 | 4055 |
5793 else if ((e = vim_strchr(ptr, '.')) == NULL) | 5799 else if ((e = vim_strchr(ptr, '.')) == NULL) |
5794 *s++ = '.'; | 5800 *s++ = '.'; |
5795 #endif | 5801 #endif |
5796 /* | 5802 /* |
5797 * If the extension doesn't start with '.', and there already is an | 5803 * If the extension doesn't start with '.', and there already is an |
5798 * extension, it may need to be tructated | 5804 * extension, it may need to be truncated |
5799 */ | 5805 */ |
5800 else if ((int)STRLEN(e) + extlen > 4) | 5806 else if ((int)STRLEN(e) + extlen > 4) |
5801 s = e + 4 - extlen; | 5807 s = e + 4 - extlen; |
5802 } | 5808 } |
5803 #if defined(OS2) || defined(USE_LONG_FNAME) || defined(WIN3264) | 5809 #if defined(OS2) || defined(USE_LONG_FNAME) || defined(WIN3264) |
5987 | 5993 |
5988 #ifdef AMIGA | 5994 #ifdef AMIGA |
5989 /* | 5995 /* |
5990 * With MSDOS-compatible filesystems (crossdos, messydos) it is possible | 5996 * With MSDOS-compatible filesystems (crossdos, messydos) it is possible |
5991 * that the name of the "to" file is the same as the "from" file, even | 5997 * that the name of the "to" file is the same as the "from" file, even |
5992 * though the names are different. To avoid the chance of accidently | 5998 * though the names are different. To avoid the chance of accidentally |
5993 * deleting the "from" file (horror!) we lock it during the remove. | 5999 * deleting the "from" file (horror!) we lock it during the remove. |
5994 * | 6000 * |
5995 * When used for making a backup before writing the file: This should not | 6001 * When used for making a backup before writing the file: This should not |
5996 * happen with ":w", because startscript() should detect this problem and | 6002 * happen with ":w", because startscript() should detect this problem and |
5997 * set buf->b_shortname, causing modname() to return a correct ".bak" file | 6003 * set buf->b_shortname, causing modname() to return a correct ".bak" file |
6056 if (n < 0) | 6062 if (n < 0) |
6057 { | 6063 { |
6058 errmsg = _("E210: Error reading \"%s\""); | 6064 errmsg = _("E210: Error reading \"%s\""); |
6059 to = from; | 6065 to = from; |
6060 } | 6066 } |
6061 #ifndef UNIX /* for Unix mch_open() already set ther permission */ | 6067 #ifndef UNIX /* for Unix mch_open() already set the permission */ |
6062 mch_setperm(to, perm); | 6068 mch_setperm(to, perm); |
6063 #endif | 6069 #endif |
6064 #ifdef HAVE_ACL | 6070 #ifdef HAVE_ACL |
6065 mch_set_acl(to, acl); | 6071 mch_set_acl(to, acl); |
6066 #endif | 6072 #endif |
8400 if (autocmd_busy && !(force || autocmd_nested)) | 8406 if (autocmd_busy && !(force || autocmd_nested)) |
8401 goto BYPASS_AU; | 8407 goto BYPASS_AU; |
8402 | 8408 |
8403 #ifdef FEAT_EVAL | 8409 #ifdef FEAT_EVAL |
8404 /* | 8410 /* |
8405 * Quickly return when immdediately aborting on error, or when an interrupt | 8411 * Quickly return when immediately aborting on error, or when an interrupt |
8406 * occurred or an exception was thrown but not caught. | 8412 * occurred or an exception was thrown but not caught. |
8407 */ | 8413 */ |
8408 if (aborting()) | 8414 if (aborting()) |
8409 goto BYPASS_AU; | 8415 goto BYPASS_AU; |
8410 #endif | 8416 #endif |