comparison src/fileio.c @ 167:c93c9cad9618

updated for version 7.0051
author vimboss
date Tue, 22 Feb 2005 08:39:57 +0000
parents 8b0ee9d57d7f
children 8c60f65311fa
comparison
equal deleted inserted replaced
166:3a28ed993bbe 167:c93c9cad9618
137 # ifdef MACOS_X 137 # ifdef MACOS_X
138 static int get_mac_fio_flags __ARGS((char_u *ptr)); 138 static int get_mac_fio_flags __ARGS((char_u *ptr));
139 # endif 139 # endif
140 #endif 140 #endif
141 static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf)); 141 static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf));
142
143 static linenr_T write_no_eol_lnum = 0; /* non-zero lnum when last line of
144 next binary write should not have
145 an end-of-line */
146 142
147 void 143 void
148 filemess(buf, name, s, attr) 144 filemess(buf, name, s, attr)
149 buf_T *buf; 145 buf_T *buf;
150 char_u *name; 146 char_u *name;
286 wasn't possible */ 282 wasn't possible */
287 char_u conv_rest[CONV_RESTLEN]; 283 char_u conv_rest[CONV_RESTLEN];
288 int conv_restlen = 0; /* nr of bytes in conv_rest[] */ 284 int conv_restlen = 0; /* nr of bytes in conv_rest[] */
289 #endif 285 #endif
290 286
291 #ifdef FEAT_AUTOCMD
292 write_no_eol_lnum = 0; /* in case it was set by the previous read */ 287 write_no_eol_lnum = 0; /* in case it was set by the previous read */
293 #endif
294 288
295 /* 289 /*
296 * If there is no file name yet, use the one for the read file. 290 * If there is no file name yet, use the one for the read file.
297 * BF_NOTEDITED is set to reflect this. 291 * BF_NOTEDITED is set to reflect this.
298 * Don't do this for a read from a filter. 292 * Don't do this for a read from a filter.
305 && !(flags & READ_DUMMY)) 299 && !(flags & READ_DUMMY))
306 { 300 {
307 if (setfname(curbuf, fname, sfname, FALSE) == OK) 301 if (setfname(curbuf, fname, sfname, FALSE) == OK)
308 curbuf->b_flags |= BF_NOTEDITED; 302 curbuf->b_flags |= BF_NOTEDITED;
309 } 303 }
304
305 /* After reading a file the cursor line changes but we don't want to
306 * display the line. */
307 ex_no_reprint = TRUE;
310 308
311 /* 309 /*
312 * For Unix: Use the short file name whenever possible. 310 * For Unix: Use the short file name whenever possible.
313 * Avoids problems with networks and when directory names are changed. 311 * Avoids problems with networks and when directory names are changed.
314 * Don't do this for MS-DOS, a "cd" in a sub-shell may have moved us to 312 * Don't do this for MS-DOS, a "cd" in a sub-shell may have moved us to
2228 * Get the marks before executing autocommands, so they can be used there. 2226 * Get the marks before executing autocommands, so they can be used there.
2229 */ 2227 */
2230 check_marks_read(); 2228 check_marks_read();
2231 #endif 2229 #endif
2232 2230
2233 #ifdef FEAT_AUTOCMD
2234 /* 2231 /*
2235 * Trick: We remember if the last line of the read didn't have 2232 * Trick: We remember if the last line of the read didn't have
2236 * an eol for when writing it again. This is required for 2233 * an eol for when writing it again. This is required for
2237 * ":autocmd FileReadPost *.gz set bin|'[,']!gunzip" to work. 2234 * ":autocmd FileReadPost *.gz set bin|'[,']!gunzip" to work.
2238 */ 2235 */
2239 write_no_eol_lnum = read_no_eol_lnum; 2236 write_no_eol_lnum = read_no_eol_lnum;
2240 2237
2238 #ifdef FEAT_AUTOCMD
2241 if (!read_stdin && !read_buffer) 2239 if (!read_stdin && !read_buffer)
2242 { 2240 {
2243 int m = msg_scroll; 2241 int m = msg_scroll;
2244 int n = msg_scrolled; 2242 int n = msg_scrolled;
2245 2243
2626 # ifdef USE_ICONV 2624 # ifdef USE_ICONV
2627 write_info.bw_iconv_fd = (iconv_t)-1; 2625 write_info.bw_iconv_fd = (iconv_t)-1;
2628 # endif 2626 # endif
2629 #endif 2627 #endif
2630 2628
2629 /* After writing a file changedtick changes but we don't want to display
2630 * the line. */
2631 ex_no_reprint = TRUE;
2632
2631 /* 2633 /*
2632 * If there is no file name yet, use the one for the written file. 2634 * If there is no file name yet, use the one for the written file.
2633 * BF_NOTEDITED is set to reflect this (in case the write fails). 2635 * BF_NOTEDITED is set to reflect this (in case the write fails).
2634 * Don't do this when the write is for a filter command. 2636 * Don't do this when the write is for a filter command.
2635 * Only do this when 'cpoptions' contains the 'f' flag. 2637 * Only do this when 'cpoptions' contains the 'f' flag.
6265 */ 6267 */
6266 void 6268 void
6267 write_lnum_adjust(offset) 6269 write_lnum_adjust(offset)
6268 linenr_T offset; 6270 linenr_T offset;
6269 { 6271 {
6270 if (write_no_eol_lnum) /* only if there is a missing eol */ 6272 if (write_no_eol_lnum != 0) /* only if there is a missing eol */
6271 write_no_eol_lnum += offset; 6273 write_no_eol_lnum += offset;
6272 } 6274 }
6273 6275
6274 #if defined(TEMPDIRNAMES) || defined(PROTO) 6276 #if defined(TEMPDIRNAMES) || defined(PROTO)
6275 static long temp_count = 0; /* Temp filename counter. */ 6277 static long temp_count = 0; /* Temp filename counter. */