Mercurial > vim
comparison src/ex_getln.c @ 632:b6632d553df3 v7.0182
updated for version 7.0182
author | vimboss |
---|---|
date | Thu, 19 Jan 2006 22:16:24 +0000 |
parents | 81fe2ccc1207 |
children | 1c586ee8dd45 |
comparison
equal
deleted
inserted
replaced
631:68a196b7504d | 632:b6632d553df3 |
---|---|
256 redrawcmdprompt(); /* draw prompt or indent */ | 256 redrawcmdprompt(); /* draw prompt or indent */ |
257 set_cmdspos(); | 257 set_cmdspos(); |
258 } | 258 } |
259 xpc.xp_context = EXPAND_NOTHING; | 259 xpc.xp_context = EXPAND_NOTHING; |
260 xpc.xp_backslash = XP_BS_NONE; | 260 xpc.xp_backslash = XP_BS_NONE; |
261 #ifndef BACKSLASH_IN_FILENAME | |
262 xpc.xp_shell = FALSE; | |
263 #endif | |
261 | 264 |
262 #if defined(FEAT_EVAL) | 265 #if defined(FEAT_EVAL) |
263 if (ccline.input_fn) | 266 if (ccline.input_fn) |
264 { | 267 { |
265 xpc.xp_context = ccline.xp_context; | 268 xpc.xp_context = ccline.xp_context; |
656 save_cmdline(&save_ccline); | 659 save_cmdline(&save_ccline); |
657 c = get_expr_register(); | 660 c = get_expr_register(); |
658 restore_cmdline(&save_ccline); | 661 restore_cmdline(&save_ccline); |
659 if (c == '=') | 662 if (c == '=') |
660 { | 663 { |
661 /* Need to save and restore ccline. And go into the | 664 /* Need to save and restore ccline. And set cmdline_busy |
662 * sandbox to avoid nasty things like going to another | 665 * to avoid nasty things like going to another buffer when |
663 * buffer when evaluating an expression. */ | 666 * evaluating an expression. */ |
664 save_cmdline(&save_ccline); | 667 save_cmdline(&save_ccline); |
665 #ifdef HAVE_SANDBOX | 668 ++cmdline_busy; |
666 ++sandbox; | |
667 #endif | |
668 p = get_expr_line(); | 669 p = get_expr_line(); |
669 #ifdef HAVE_SANDBOX | 670 --cmdline_busy; |
670 --sandbox; | |
671 #endif | |
672 restore_cmdline(&save_ccline); | 671 restore_cmdline(&save_ccline); |
673 | 672 |
674 if (p != NULL && realloc_cmdbuff((int)STRLEN(p) + 1) == OK) | 673 if (p != NULL && realloc_cmdbuff((int)STRLEN(p) + 1) == OK) |
675 { | 674 { |
676 ccline.cmdlen = STRLEN(p); | 675 ccline.cmdlen = STRLEN(p); |
1873 | 1872 |
1874 return s; | 1873 return s; |
1875 } | 1874 } |
1876 #endif | 1875 #endif |
1877 | 1876 |
1877 /* | |
1878 * Return TRUE when the command line is being edited. That means the current | |
1879 * buffer and window can't be changed. | |
1880 */ | |
1881 int | |
1882 editing_cmdline() | |
1883 { | |
1884 #ifdef FEAT_CMDWIN | |
1885 if (cmdwin_type != 0) | |
1886 return TRUE; | |
1887 #endif | |
1888 return cmdline_busy; | |
1889 } | |
1890 | |
1891 /* | |
1892 * Give an error message for a command that isn't allowed while the cmdline | |
1893 * window is open or editing the cmdline in another way. | |
1894 */ | |
1895 void | |
1896 editing_cmdline_msg() | |
1897 { | |
1898 #ifdef FEAT_CMDWIN | |
1899 if (cmdwin_type != 0) | |
1900 EMSG(_(e_cmdwin)); | |
1901 else | |
1902 #endif | |
1903 EMSG(_(e_secure)); | |
1904 } | |
1905 | |
1878 static int | 1906 static int |
1879 cmdline_charsize(idx) | 1907 cmdline_charsize(idx) |
1880 int idx; | 1908 int idx; |
1881 { | 1909 { |
1882 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) | 1910 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) |
2784 | 2812 |
2785 #ifdef FEAT_CLIPBOARD | 2813 #ifdef FEAT_CLIPBOARD |
2786 regname = may_get_selection(regname); | 2814 regname = may_get_selection(regname); |
2787 #endif | 2815 #endif |
2788 | 2816 |
2789 /* Need to save and restore ccline. And go into the sandbox to avoid | 2817 /* Need to save and restore ccline. And set cmdline_busy to avoid nasty |
2790 * nasty things like going to another buffer when evaluating an | 2818 * things like going to another buffer when evaluating an expression. */ |
2791 * expression. */ | |
2792 save_cmdline(&save_ccline); | 2819 save_cmdline(&save_ccline); |
2793 #ifdef HAVE_SANDBOX | 2820 ++cmdline_busy; |
2794 ++sandbox; | |
2795 #endif | |
2796 i = get_spec_reg(regname, &arg, &allocated, TRUE); | 2821 i = get_spec_reg(regname, &arg, &allocated, TRUE); |
2797 #ifdef HAVE_SANDBOX | 2822 --cmdline_busy; |
2798 --sandbox; | |
2799 #endif | |
2800 restore_cmdline(&save_ccline); | 2823 restore_cmdline(&save_ccline); |
2801 | 2824 |
2802 if (i) | 2825 if (i) |
2803 { | 2826 { |
2804 /* Got the value of a special register in "arg". */ | 2827 /* Got the value of a special register in "arg". */ |
3366 void | 3389 void |
3367 ExpandInit(xp) | 3390 ExpandInit(xp) |
3368 expand_T *xp; | 3391 expand_T *xp; |
3369 { | 3392 { |
3370 xp->xp_backslash = XP_BS_NONE; | 3393 xp->xp_backslash = XP_BS_NONE; |
3394 #ifndef BACKSLASH_IN_FILENAME | |
3395 xp->xp_shell = FALSE; | |
3396 #endif | |
3371 xp->xp_numfiles = -1; | 3397 xp->xp_numfiles = -1; |
3372 xp->xp_files = NULL; | 3398 xp->xp_files = NULL; |
3399 #if defined(FEAT_USR_CMDS) && defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) | |
3400 xp->xp_arg = NULL; | |
3401 #endif | |
3373 } | 3402 } |
3374 | 3403 |
3375 /* | 3404 /* |
3376 * Cleanup an expand structure after use. | 3405 * Cleanup an expand structure after use. |
3377 */ | 3406 */ |
3444 buf[j++] = *p; | 3473 buf[j++] = *p; |
3445 buf[j] = NUL; | 3474 buf[j] = NUL; |
3446 p = vim_strsave_escaped(files[i], buf); | 3475 p = vim_strsave_escaped(files[i], buf); |
3447 } | 3476 } |
3448 #else | 3477 #else |
3449 p = vim_strsave_escaped(files[i], PATH_ESC_CHARS); | 3478 p = vim_strsave_escaped(files[i], |
3479 xp->xp_shell ? SHELL_ESC_CHARS : PATH_ESC_CHARS); | |
3450 #endif | 3480 #endif |
3451 if (p != NULL) | 3481 if (p != NULL) |
3452 { | 3482 { |
3453 vim_free(files[i]); | 3483 vim_free(files[i]); |
3454 files[i] = p; | 3484 files[i] = p; |
4525 | 4555 |
4526 buf = alloc(MAXPATHL); | 4556 buf = alloc(MAXPATHL); |
4527 if (buf == NULL) | 4557 if (buf == NULL) |
4528 return NULL; | 4558 return NULL; |
4529 | 4559 |
4560 ExpandInit(&xpc); | |
4530 xpc.xp_context = EXPAND_FILES; | 4561 xpc.xp_context = EXPAND_FILES; |
4531 xpc.xp_backslash = XP_BS_NONE; | 4562 |
4532 ga_init2(&ga, 1, 100); | 4563 ga_init2(&ga, 1, 100); |
4533 | 4564 |
4534 /* Loop over all entries in {path}. */ | 4565 /* Loop over all entries in {path}. */ |
4535 while (*path != NUL) | 4566 while (*path != NUL) |
4536 { | 4567 { |