comparison src/diff.c @ 819:23f82b5d2814 v7.0c10

updated for version 7.0c10
author vimboss
date Wed, 05 Apr 2006 20:41:53 +0000
parents 986753bbc441
children 6675076019ae
comparison
equal deleted inserted replaced
818:1f929f3ca806 819:23f82b5d2814
998 eap->arg = newname; 998 eap->arg = newname;
999 ex_file(eap); 999 ex_file(eap);
1000 1000
1001 #ifdef FEAT_AUTOCMD 1001 #ifdef FEAT_AUTOCMD
1002 /* Do filetype detection with the new name. */ 1002 /* Do filetype detection with the new name. */
1003 do_cmdline_cmd((char_u *)":doau filetypedetect BufRead"); 1003 if (au_has_group((char_u *)"filetypedetect"))
1004 do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
1004 #endif 1005 #endif
1005 } 1006 }
1006 } 1007 }
1007 } 1008 }
1008 1009
2052 idx_to = idx_other; 2053 idx_to = idx_other;
2053 /* Need to make the other buffer the current buffer to be able to make 2054 /* Need to make the other buffer the current buffer to be able to make
2054 * changes in it. */ 2055 * changes in it. */
2055 /* set curwin/curbuf to buf and save a few things */ 2056 /* set curwin/curbuf to buf and save a few things */
2056 aucmd_prepbuf(&aco, curtab->tp_diffbuf[idx_other]); 2057 aucmd_prepbuf(&aco, curtab->tp_diffbuf[idx_other]);
2058 }
2059
2060 /* May give the warning for a changed buffer here, which can trigger the
2061 * FileChangedRO autocommand, which may do nasty things and mess
2062 * everything up. */
2063 if (!curbuf->b_changed)
2064 {
2065 change_warning(0);
2066 if (diff_buf_idx(curbuf) != idx_to)
2067 {
2068 EMSG(_("E787: Buffer changed unexpectedly"));
2069 return;
2070 }
2057 } 2071 }
2058 2072
2059 dprev = NULL; 2073 dprev = NULL;
2060 for (dp = curtab->tp_first_diff; dp != NULL; ) 2074 for (dp = curtab->tp_first_diff; dp != NULL; )
2061 { 2075 {
2129 linenr_T nr; 2143 linenr_T nr;
2130 2144
2131 nr = dp->df_lnum[idx_from] + start_skip + i; 2145 nr = dp->df_lnum[idx_from] + start_skip + i;
2132 if (nr > curtab->tp_diffbuf[idx_from]->b_ml.ml_line_count) 2146 if (nr > curtab->tp_diffbuf[idx_from]->b_ml.ml_line_count)
2133 break; 2147 break;
2134 p = vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx_from], nr, FALSE)); 2148 p = vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx_from],
2149 nr, FALSE));
2135 if (p != NULL) 2150 if (p != NULL)
2136 { 2151 {
2137 ml_append(lnum + i - 1, p, 0, FALSE); 2152 ml_append(lnum + i - 1, p, 0, FALSE);
2138 vim_free(p); 2153 vim_free(p);
2139 ++added; 2154 ++added;
2152 if (start_skip == 0 && end_skip == 0) 2167 if (start_skip == 0 && end_skip == 0)
2153 { 2168 {
2154 /* Check if there are any other buffers and if the diff is 2169 /* Check if there are any other buffers and if the diff is
2155 * equal in them. */ 2170 * equal in them. */
2156 for (i = 0; i < DB_COUNT; ++i) 2171 for (i = 0; i < DB_COUNT; ++i)
2157 if (curtab->tp_diffbuf[i] != NULL && i != idx_from && i != idx_to 2172 if (curtab->tp_diffbuf[i] != NULL && i != idx_from
2173 && i != idx_to
2158 && !diff_equal_entry(dp, idx_from, i)) 2174 && !diff_equal_entry(dp, idx_from, i))
2159 break; 2175 break;
2160 if (i == DB_COUNT) 2176 if (i == DB_COUNT)
2161 { 2177 {
2162 /* delete the diff entry, the buffers are now equal here */ 2178 /* delete the diff entry, the buffers are now equal here */