updated for version 7.0037

This commit is contained in:
Bram Moolenaar
2005-01-11 21:29:04 +00:00
parent f7889b6c73
commit 5f2bb9f584
11 changed files with 284 additions and 73 deletions

View File

@ -80,6 +80,8 @@ static void correct_cmdspos __ARGS((int idx, int cells));
static void alloc_cmdbuff __ARGS((int len));
static int realloc_cmdbuff __ARGS((int len));
static void draw_cmdline __ARGS((int start, int len));
static void save_cmdline __ARGS((struct cmdline_info *ccp));
static void restore_cmdline __ARGS((struct cmdline_info *ccp));
static int cmdline_paste __ARGS((int regname, int literally));
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
static void redrawcmd_preedit __ARGS((void));
@ -593,8 +595,8 @@ getcmdline(firstc, count, indent)
#ifdef FEAT_EVAL
else if (c == 'e')
{
struct cmdline_info save_ccline;
char_u *p;
struct cmdline_info save_ccline;
char_u *p = NULL;
/*
* Replace the command line with the result of an expression.
@ -605,16 +607,17 @@ getcmdline(firstc, count, indent)
new_cmdpos = 99999; /* keep it at the end */
else
new_cmdpos = ccline.cmdpos;
save_ccline = ccline;
ccline.cmdbuff = NULL;
ccline.cmdprompt = NULL;
save_cmdline(&save_ccline);
c = get_expr_register();
ccline = save_ccline;
restore_cmdline(&save_ccline);
if (c == '=')
{
save_cmdline(&save_ccline);
p = get_expr_line();
if (p != NULL
&& realloc_cmdbuff((int)STRLEN(p) + 1) == OK)
restore_cmdline(&save_ccline);
if (p != NULL && realloc_cmdbuff((int)STRLEN(p) + 1) == OK)
{
ccline.cmdlen = STRLEN(p);
STRCPY(ccline.cmdbuff, p);
@ -1031,11 +1034,9 @@ getcmdline(firstc, count, indent)
}
else
{
save_ccline = ccline;
ccline.cmdbuff = NULL;
ccline.cmdprompt = NULL;
save_cmdline(&save_ccline);
c = get_expr_register();
ccline = save_ccline;
restore_cmdline(&save_ccline);
}
}
#endif
@ -1727,7 +1728,13 @@ returncmd:
ui_cursor_shape(); /* may show different cursor shape */
#endif
return ccline.cmdbuff;
{
char_u *p = ccline.cmdbuff;
/* Make ccline empty, getcmdline() may try to use it. */
ccline.cmdbuff = NULL;
return p;
}
}
#if (defined(FEAT_CRYPT) || defined(FEAT_EVAL)) || defined(PROTO)
@ -1747,12 +1754,11 @@ getcmdline_prompt(firstc, prompt, attr)
struct cmdline_info save_ccline;
int msg_col_save = msg_col;
save_ccline = ccline;
ccline.cmdbuff = NULL;
save_cmdline(&save_ccline);
ccline.cmdprompt = prompt;
ccline.cmdattr = attr;
s = getcmdline(firstc, 1L, 0);
ccline = save_ccline;
restore_cmdline(&save_ccline);
/* Restore msg_col, the prompt from input() may have changed it. */
msg_col = msg_col_save;
@ -2538,6 +2544,40 @@ put_on_cmdline(str, len, redraw)
return retval;
}
static struct cmdline_info prev_ccline;
static int prev_ccline_used = FALSE;
/*
* Save ccline, because obtaining the "=" register may execute "normal :cmd"
* and overwrite it. But get_cmdline_str() may need it, thus make it
* available globally in prev_ccline.
*/
static void
save_cmdline(ccp)
struct cmdline_info *ccp;
{
if (!prev_ccline_used)
{
vim_memset(&prev_ccline, 0, sizeof(struct cmdline_info));
prev_ccline_used = TRUE;
}
*ccp = prev_ccline;
prev_ccline = ccline;
ccline.cmdbuff = NULL;
ccline.cmdprompt = NULL;
}
/*
* Resture ccline after it has been saved with save_cmdline().
*/
static void
restore_cmdline(ccp)
struct cmdline_info *ccp;
{
ccline = prev_ccline;
prev_ccline = *ccp;
}
/*
* paste a yank register into the command line.
* used by CTRL-R command in command-line mode
@ -2572,13 +2612,10 @@ cmdline_paste(regname, literally)
regname = may_get_selection(regname);
#endif
/* Need to save and restore ccline, because obtaining the "=" register may
* execute "normal :cmd" and overwrite it. */
save_ccline = ccline;
ccline.cmdbuff = NULL;
ccline.cmdprompt = NULL;
/* Need to save and restore ccline. */
save_cmdline(&save_ccline);
i = get_spec_reg(regname, &arg, &allocated, TRUE);
ccline = save_ccline;
restore_cmdline(&save_ccline);
if (i)
{
@ -4534,6 +4571,24 @@ get_history_idx(histype)
return history[histype][hisidx[histype]].hisnum;
}
static struct cmdline_info *get_ccline_ptr __ARGS((void));
/*
* Get pointer to the command line info to use. cmdline_paste() may clear
* ccline and put the previous value in prev_ccline.
*/
static struct cmdline_info *
get_ccline_ptr()
{
if ((State & CMDLINE) == 0)
return NULL;
if (ccline.cmdbuff != NULL)
return &ccline;
if (prev_ccline_used && prev_ccline.cmdbuff != NULL)
return &prev_ccline;
return NULL;
}
/*
* Get the current command line in allocated memory.
* Only works when the command line is being edited.
@ -4542,9 +4597,11 @@ get_history_idx(histype)
char_u *
get_cmdline_str()
{
if (ccline.cmdbuff == NULL || (State & CMDLINE) == 0)
struct cmdline_info *p = get_ccline_ptr();
if (p == NULL)
return NULL;
return vim_strnsave(ccline.cmdbuff, ccline.cmdlen);
return vim_strnsave(p->cmdbuff, p->cmdlen);
}
/*
@ -4556,9 +4613,11 @@ get_cmdline_str()
int
get_cmdline_pos()
{
if (ccline.cmdbuff == NULL || (State & CMDLINE) == 0)
struct cmdline_info *p = get_ccline_ptr();
if (p == NULL)
return -1;
return ccline.cmdpos;
return p->cmdpos;
}
/*
@ -4570,7 +4629,9 @@ get_cmdline_pos()
set_cmdline_pos(pos)
int pos;
{
if (ccline.cmdbuff == NULL || (State & CMDLINE) == 0)
struct cmdline_info *p = get_ccline_ptr();
if (p == NULL)
return 1;
/* The position is not set directly but after CTRL-\ e or CTRL-R = has

View File

@ -1422,7 +1422,7 @@ gui_mch_browsedir(
#endif /* FEAT_BROWSE */
#if (defined(FEAT_GUI_DIALOG) && !defined(HAVE_GTK2)) || defined(PROTO)
#if defined(FEAT_GUI_DIALOG) && !defined(HAVE_GTK2)
static char_u *dialog_textfield = NULL;
static GtkWidget *dialog_textentry;
@ -1956,7 +1956,7 @@ gui_mch_dialog( int type, /* type of dialog */
#endif /* FEAT_GUI_DIALOG && !HAVE_GTK2 */
#if defined(FEAT_GUI_DIALOG) && defined(HAVE_GTK2)
#if (defined(FEAT_GUI_DIALOG) && defined(HAVE_GTK2)) || defined(PROTO)
static GtkWidget *
create_message_dialog(int type, char_u *title, char_u *message)

View File

@ -5674,7 +5674,8 @@ display_errors()
/*
* Get current mouse coordinates in text window.
*/
void gui_mch_getmouse(int *x, int *y)
void
gui_mch_getmouse(int *x, int *y)
{
Point where;

View File

@ -1895,7 +1895,7 @@ gui_mch_mousehide(int hide)
}
}
int
void
gui_mch_getmouse(int *x, int *y)
{
PhCursorInfo_t info;

View File

@ -4,6 +4,7 @@ int do_cmdline_cmd __ARGS((char_u *cmd));
int do_cmdline __ARGS((char_u *cmdline, char_u *(*getline)(int, void *, int), void *cookie, int flags));
int getline_equal __ARGS((char_u *(*getline)(int, void *, int), void *cookie, char_u *(*func)(int, void *, int)));
void *getline_cookie __ARGS((char_u *(*getline)(int, void *, int), void *cookie));
int checkforcmd __ARGS((char_u **pp, char *cmd, int len));
int cmd_exists __ARGS((char_u *name));
char_u *set_one_cmd_context __ARGS((expand_T *xp, char_u *buff));
char_u *skip_range __ARGS((char_u *cmd, int *ctx));

View File

@ -2295,7 +2295,7 @@ ex_vimgrep(eap)
regmatch.regprog = vim_regcomp(s, RE_MAGIC);
if (regmatch.regprog == NULL)
goto theend;
regmatch.rmm_ic = FALSE;
regmatch.rmm_ic = p_ic;
p = skipwhite(p);
if (*p == NUL)

View File

@ -1,6 +1,6 @@
" Vim script language tests
" Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
" Last Change: 2004 Apr 03
" Last Change: 2005 Jan 11
"-------------------------------------------------------------------------------
" Test environment {{{1
@ -8433,7 +8433,7 @@ if ExtraVim()
call T(23, '(1 ? 2) + CONT(23)', 'E109', "Missing ':' after '?'")
call T(24, '("abc) + CONT(24)', 'E114', "Missing quote")
call T(25, "('abc) + CONT(25)", 'E115', "Missing quote")
call T(26, '& + CONT(26)', 'E112', "Option name missing")
call T(26, '& + CONT(26)', 'E712', "Using & outside of map()")
call T(27, '&asdf + CONT(27)', 'E113', "Unknown option")
Xpath 134217728 " X: 134217728

View File

@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 9)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 9, compiled "
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 11)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 11, compiled "