comparison src/os_win32.c @ 41:f529edb9bab3 v7.0025

updated for version 7.0025
author vimboss
date Mon, 27 Dec 2004 21:59:20 +0000
parents 410fa1a31baf
children 80000fb16feb
comparison
equal deleted inserted replaced
40:f1d2a58883b9 41:f529edb9bab3
4986 fix_arg_enc(void) 4986 fix_arg_enc(void)
4987 { 4987 {
4988 int i; 4988 int i;
4989 int idx; 4989 int idx;
4990 char_u *str; 4990 char_u *str;
4991 int *fnum_list;
4991 4992
4992 /* Safety checks: 4993 /* Safety checks:
4993 * - if argument count differs between the wide and non-wide argument 4994 * - if argument count differs between the wide and non-wide argument
4994 * list, something must be wrong. 4995 * list, something must be wrong.
4995 * - the file name arguments must have been located. 4996 * - the file name arguments must have been located.
5000 || used_file_indexes == NULL 5001 || used_file_indexes == NULL
5001 || used_file_count == 0 5002 || used_file_count == 0
5002 || used_alist_count != GARGCOUNT) 5003 || used_alist_count != GARGCOUNT)
5003 return; 5004 return;
5004 5005
5006 /* Remember the buffer numbers for the arguments. */
5007 fnum_list = (int *)alloc((int)sizeof(int) * GARGCOUNT);
5008 if (fnum_list == NULL)
5009 return; /* out of memory */
5010 for (i = 0; i < GARGCOUNT; ++i)
5011 fnum_list[i] = GARGLIST[i].ae_fnum;
5012
5005 /* Clear the argument list. Make room for the new arguments. */ 5013 /* Clear the argument list. Make room for the new arguments. */
5006 alist_clear(&global_alist); 5014 alist_clear(&global_alist);
5007 if (ga_grow(&global_alist.al_ga, used_file_count) == FAIL) 5015 if (ga_grow(&global_alist.al_ga, used_file_count) == FAIL)
5008 return; /* out of memory */ 5016 return; /* out of memory */
5009 5017
5010 for (i = 0; i < used_file_count; ++i) 5018 for (i = 0; i < used_file_count; ++i)
5011 { 5019 {
5012 idx = used_file_indexes[i]; 5020 idx = used_file_indexes[i];
5013 str = ucs2_to_enc(ArglistW[idx], NULL); 5021 str = ucs2_to_enc(ArglistW[idx], NULL);
5014 if (str != NULL) 5022 if (str != NULL)
5023 {
5024 /* Re-use the old buffer by renaming it. When not using literal
5025 * names it's done by alist_expand() below. */
5026 if (used_file_literal)
5027 buf_set_name(fnum_list[i], str);
5028
5015 alist_add(&global_alist, str, used_file_literal ? 2 : 0); 5029 alist_add(&global_alist, str, used_file_literal ? 2 : 0);
5030 }
5016 } 5031 }
5017 5032
5018 if (!used_file_literal) 5033 if (!used_file_literal)
5019 { 5034 {
5020 /* Now expand wildcards in the arguments. */ 5035 /* Now expand wildcards in the arguments. */
5021 /* Temporarily add '(' and ')' to 'isfname'. These are valid 5036 /* Temporarily add '(' and ')' to 'isfname'. These are valid
5022 * filename characters but are excluded from 'isfname' to make 5037 * filename characters but are excluded from 'isfname' to make
5023 * "gf" work on a file name in parenthesis (e.g.: see vim.h). */ 5038 * "gf" work on a file name in parenthesis (e.g.: see vim.h). */
5024 do_cmdline_cmd((char_u *)":let SaVe_ISF = &isf|set isf+=(,)"); 5039 do_cmdline_cmd((char_u *)":let SaVe_ISF = &isf|set isf+=(,)");
5025 alist_expand(); 5040 alist_expand(fnum_list, used_alist_count);
5026 do_cmdline_cmd((char_u *)":let &isf = SaVe_ISF|unlet SaVe_ISF"); 5041 do_cmdline_cmd((char_u *)":let &isf = SaVe_ISF|unlet SaVe_ISF");
5027 } 5042 }
5028 5043
5029 /* If wildcard expansion failed, we are editing the first file of the 5044 /* If wildcard expansion failed, we are editing the first file of the
5030 * arglist and there is no file name: Edit the first argument now. */ 5045 * arglist and there is no file name: Edit the first argument now. */
5032 { 5047 {
5033 do_cmdline_cmd((char_u *)":rewind"); 5048 do_cmdline_cmd((char_u *)":rewind");
5034 if (GARGCOUNT == 1 && used_file_full_path) 5049 if (GARGCOUNT == 1 && used_file_full_path)
5035 (void)vim_chdirfile(alist_name(&GARGLIST[0])); 5050 (void)vim_chdirfile(alist_name(&GARGLIST[0]));
5036 } 5051 }
5037 } 5052
5038 #endif 5053 set_alist_count();
5054 }
5055 #endif