Mercurial > vim
comparison src/misc1.c @ 819:23f82b5d2814 v7.0c10
updated for version 7.0c10
author | vimboss |
---|---|
date | Wed, 05 Apr 2006 20:41:53 +0000 |
parents | 9f345c48220b |
children | fd1b3406fd1c |
comparison
equal
deleted
inserted
replaced
818:1f929f3ca806 | 819:23f82b5d2814 |
---|---|
2435 | 2435 |
2436 if (!curbuf->b_changed) | 2436 if (!curbuf->b_changed) |
2437 { | 2437 { |
2438 int save_msg_scroll = msg_scroll; | 2438 int save_msg_scroll = msg_scroll; |
2439 | 2439 |
2440 /* Give a warning about changing a read-only file. This may also | |
2441 * check-out the file, thus change "curbuf"! */ | |
2440 change_warning(0); | 2442 change_warning(0); |
2443 | |
2441 /* Create a swap file if that is wanted. | 2444 /* Create a swap file if that is wanted. |
2442 * Don't do this for "nofile" and "nowrite" buffer types. */ | 2445 * Don't do this for "nofile" and "nowrite" buffer types. */ |
2443 if (curbuf->b_may_swap | 2446 if (curbuf->b_may_swap |
2444 #ifdef FEAT_QUICKFIX | 2447 #ifdef FEAT_QUICKFIX |
2445 && !bt_dontwrite(curbuf) | 2448 && !bt_dontwrite(curbuf) |
2911 && !autocmd_busy | 2914 && !autocmd_busy |
2912 #endif | 2915 #endif |
2913 && curbuf->b_p_ro) | 2916 && curbuf->b_p_ro) |
2914 { | 2917 { |
2915 #ifdef FEAT_AUTOCMD | 2918 #ifdef FEAT_AUTOCMD |
2919 ++curbuf_lock; | |
2916 apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf); | 2920 apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf); |
2921 --curbuf_lock; | |
2917 if (!curbuf->b_p_ro) | 2922 if (!curbuf->b_p_ro) |
2918 return; | 2923 return; |
2919 #endif | 2924 #endif |
2920 /* | 2925 /* |
2921 * Do what msg() does, but with a column offset if the warning should | 2926 * Do what msg() does, but with a column offset if the warning should |
4443 #ifdef UNIX | 4448 #ifdef UNIX |
4444 return (c == ':'); | 4449 return (c == ':'); |
4445 #else | 4450 #else |
4446 return (c == ';'); /* might not be rigth for every system... */ | 4451 return (c == ';'); /* might not be rigth for every system... */ |
4447 #endif | 4452 #endif |
4453 } | |
4454 #endif | |
4455 | |
4456 #if defined(FEAT_GUI_TABLINE) || defined(FEAT_WINDOWS) \ | |
4457 || defined(FEAT_EVAL) || defined(PROTO) | |
4458 /* | |
4459 * Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname" | |
4460 * It's done in-place. | |
4461 */ | |
4462 void | |
4463 shorten_dir(str) | |
4464 char_u *str; | |
4465 { | |
4466 char_u *tail, *s, *d; | |
4467 int skip = FALSE; | |
4468 | |
4469 tail = gettail(str); | |
4470 d = str; | |
4471 for (s = str; ; ++s) | |
4472 { | |
4473 if (s >= tail) /* copy the whole tail */ | |
4474 { | |
4475 *d++ = *s; | |
4476 if (*s == NUL) | |
4477 break; | |
4478 } | |
4479 else if (vim_ispathsep(*s)) /* copy '/' and next char */ | |
4480 { | |
4481 *d++ = *s; | |
4482 skip = FALSE; | |
4483 } | |
4484 else if (!skip) | |
4485 { | |
4486 *d++ = *s; /* copy next char */ | |
4487 if (*s != '~' && *s != '.') /* and leading "~" and "." */ | |
4488 skip = TRUE; | |
4489 # ifdef FEAT_MBYTE | |
4490 if (has_mbyte) | |
4491 { | |
4492 int l = mb_ptr2len(s); | |
4493 | |
4494 while (--l > 0) | |
4495 *d++ = *s++; | |
4496 } | |
4497 # endif | |
4498 } | |
4499 } | |
4448 } | 4500 } |
4449 #endif | 4501 #endif |
4450 | 4502 |
4451 /* | 4503 /* |
4452 * Return TRUE if the directory of "fname" exists, FALSE otherwise. | 4504 * Return TRUE if the directory of "fname" exists, FALSE otherwise. |