diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-23 22:40:29 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-23 22:40:29 +0000 |
commit | 4a85b4156098a30daf5b15a7fb7587a1c7c99f94 (patch) | |
tree | a1874218752c56897f955c24b012836b8c9e80f8 /src | |
parent | eb3593b38b7b6b658e93ad05d6caf76d58cc0c35 (diff) | |
download | vim-git-4a85b4156098a30daf5b15a7fb7587a1c7c99f94.tar.gz |
updated for version 7.0e07v7.0e07
Diffstat (limited to 'src')
-rw-r--r-- | src/edit.c | 26 | ||||
-rw-r--r-- | src/eval.c | 38 | ||||
-rw-r--r-- | src/getchar.c | 23 | ||||
-rw-r--r-- | src/globals.h | 7 | ||||
-rw-r--r-- | src/gui_gtk_x11.c | 3 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/os_mac.h | 2 | ||||
-rw-r--r-- | src/proto/edit.pro | 79 | ||||
-rw-r--r-- | src/version.h | 6 |
9 files changed, 117 insertions, 69 deletions
diff --git a/src/edit.c b/src/edit.c index 2c9711960..b96380ead 100644 --- a/src/edit.c +++ b/src/edit.c @@ -124,6 +124,7 @@ static expand_T compl_xp; static void ins_ctrl_x __ARGS((void)); static int has_compl_option __ARGS((int dict_opt)); +static int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags, int dup)); static int ins_compl_equal __ARGS((compl_T *match, char_u *str, int len)); static void ins_compl_longest_match __ARGS((compl_T *match)); static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int icase)); @@ -2076,9 +2077,10 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags) /* Copy the original case of the part we typed */ STRNCPY(IObuff, compl_orig_text, compl_length); - return ins_compl_add(IObuff, len, icase, fname, NULL, dir, flags); + return ins_compl_add(IObuff, len, icase, fname, NULL, dir, + flags, FALSE); } - return ins_compl_add(str, len, icase, fname, NULL, dir, flags); + return ins_compl_add(str, len, icase, fname, NULL, dir, flags, FALSE); } /* @@ -2087,15 +2089,16 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags) * NOTDONE, otherwise add it to the list and return OK. If there is an error, * maybe because alloc() returns NULL, then FAIL is returned. */ - int -ins_compl_add(str, len, icase, fname, cptext, cdir, flags) + static int +ins_compl_add(str, len, icase, fname, cptext, cdir, flags, dup) char_u *str; int len; int icase; char_u *fname; - char_u **cptext; /* extra text for popup menu or NULL */ + char_u **cptext; /* extra text for popup menu or NULL */ int cdir; int flags; + int dup; /* accept duplicate match */ { compl_T *match; int dir = (cdir == 0 ? compl_direction : cdir); @@ -2109,7 +2112,7 @@ ins_compl_add(str, len, icase, fname, cptext, cdir, flags) /* * If the same match is already present, don't add it. */ - if (compl_first_match != NULL) + if (compl_first_match != NULL && !dup) { match = compl_first_match; do @@ -2301,7 +2304,7 @@ ins_compl_add_matches(num_matches, matches, icase) for (i = 0; i < num_matches && add_r != FAIL; i++) if ((add_r = ins_compl_add(matches[i], -1, icase, - NULL, NULL, dir, 0)) == OK) + NULL, NULL, dir, 0, FALSE)) == OK) /* if dir was BACKWARD then honor it just once */ dir = FORWARD; FreeWild(num_matches, matches); @@ -2359,7 +2362,7 @@ set_completion(startcol, list) /* compl_pattern doesn't need to be set */ compl_orig_text = vim_strnsave(ml_get_curline() + compl_col, compl_length); if (compl_orig_text == NULL || ins_compl_add(compl_orig_text, - -1, FALSE, NULL, NULL, 0, ORIGINAL_TEXT) != OK) + -1, FALSE, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK) return; /* Handle like dictionary completion. */ @@ -3494,6 +3497,7 @@ ins_compl_add_tv(tv, dir) { char_u *word; int icase = p_ic; + int dup = FALSE; char_u *(cptext[CPT_COUNT]); if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL) @@ -3509,6 +3513,8 @@ ins_compl_add_tv(tv, dir) (char_u *)"info", FALSE); if (get_dict_string(tv->vval.v_dict, (char_u *)"icase", FALSE) != NULL) icase = get_dict_number(tv->vval.v_dict, (char_u *)"icase"); + if (get_dict_string(tv->vval.v_dict, (char_u *)"dup", FALSE) != NULL) + dup = get_dict_number(tv->vval.v_dict, (char_u *)"dup"); } else { @@ -3517,7 +3523,7 @@ ins_compl_add_tv(tv, dir) } if (word == NULL || *word == NUL) return FAIL; - return ins_compl_add(word, -1, icase, NULL, cptext, dir, 0); + return ins_compl_add(word, -1, icase, NULL, cptext, dir, 0, dup); } #endif @@ -4616,7 +4622,7 @@ ins_complete(c) vim_free(compl_orig_text); compl_orig_text = vim_strnsave(line + compl_col, compl_length); if (compl_orig_text == NULL || ins_compl_add(compl_orig_text, - -1, FALSE, NULL, NULL, 0, ORIGINAL_TEXT) != OK) + -1, FALSE, NULL, NULL, 0, ORIGINAL_TEXT, FALSE) != OK) { vim_free(compl_pattern); compl_pattern = NULL; diff --git a/src/eval.c b/src/eval.c index 14460a0a9..080278416 100644 --- a/src/eval.c +++ b/src/eval.c @@ -587,6 +587,7 @@ static void f_pathshorten __ARGS((typval_T *argvars, typval_T *rettv)); static void f_prevnonblank __ARGS((typval_T *argvars, typval_T *rettv)); static void f_printf __ARGS((typval_T *argvars, typval_T *rettv)); static void f_pumvisible __ARGS((typval_T *argvars, typval_T *rettv)); +static void f_pushkeys __ARGS((typval_T *argvars, typval_T *rettv)); static void f_range __ARGS((typval_T *argvars, typval_T *rettv)); static void f_readfile __ARGS((typval_T *argvars, typval_T *rettv)); static void f_reltime __ARGS((typval_T *argvars, typval_T *rettv)); @@ -7101,6 +7102,7 @@ static struct fst {"prevnonblank", 1, 1, f_prevnonblank}, {"printf", 2, 19, f_printf}, {"pumvisible", 0, 0, f_pumvisible}, + {"pushkeys", 1, 2, f_pushkeys}, {"range", 1, 3, f_range}, {"readfile", 1, 3, f_readfile}, {"reltime", 0, 2, f_reltime}, @@ -12619,6 +12621,42 @@ f_pumvisible(argvars, rettv) } /* + * "pushkeys()" function + */ +/*ARGSUSED*/ + static void +f_pushkeys(argvars, rettv) + typval_T *argvars; + typval_T *rettv; +{ + int remap = TRUE; + char_u *keys, *flags; + char_u nbuf[NUMBUFLEN]; + + rettv->vval.v_number = 0; + keys = get_tv_string(&argvars[0]); + if (*keys != NUL) + { + if (argvars[1].v_type != VAR_UNKNOWN) + { + flags = get_tv_string_buf(&argvars[1], nbuf); + for ( ; *flags != NUL; ++flags) + { + switch (*flags) + { + case 'n': remap = FALSE; break; + case 'm': remap = TRUE; break; + } + } + } + + ins_typebuf(keys, (remap ? REMAP_YES : REMAP_NONE), + typebuf.tb_len, TRUE, FALSE); + typebuf_was_filled = TRUE; + } +} + +/* * "range()" function */ static void diff --git a/src/getchar.c b/src/getchar.c index 782bdbee0..89df484a2 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1034,7 +1034,8 @@ ins_typebuf(str, noremap, offset, nottyped, silent) /* * Return TRUE if the typeahead buffer was changed (while waiting for a - * character to arrive). Happens when a message was received from a client. + * character to arrive). Happens when a message was received from a client or + * from pushkeys(). * But check in a more generic way to avoid trouble: When "typebuf.tb_buf" * changed it was reallocated and the old pointer can no longer be used. * Or "typebuf.tb_off" may have been changed and we would overwrite characters @@ -1045,8 +1046,8 @@ typebuf_changed(tb_change_cnt) int tb_change_cnt; /* old value of typebuf.tb_change_cnt */ { return (tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt -#ifdef FEAT_CLIENTSERVER - || received_from_client +#if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) + || typebuf_was_filled #endif )); } @@ -1142,10 +1143,10 @@ del_typebuf(len, offset) typebuf.tb_no_abbr_cnt -= len; } -#ifdef FEAT_CLIENTSERVER - /* Reset the flag that text received from a client was inserted in the - * typeahead buffer. */ - received_from_client = FALSE; +#if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) + /* Reset the flag that text received from a client or from pushkeys() + * was inserted in the typeahead buffer. */ + typebuf_was_filled = FALSE; #endif if (++typebuf.tb_change_cnt == 0) typebuf.tb_change_cnt = 1; @@ -2917,15 +2918,15 @@ fix_input_buffer(buf, len, script) /* * Return TRUE when bytes are in the input buffer or in the typeahead buffer. * Normally the input buffer would be sufficient, but the server_to_input_buf() - * may insert characters in the typeahead buffer while we are waiting for - * input to arrive. + * or pushkeys() may insert characters in the typeahead buffer while we are + * waiting for input to arrive. */ int input_available() { return (!vim_is_input_buf_empty() -# ifdef FEAT_CLIENTSERVER - || received_from_client +# if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) + || typebuf_was_filled # endif ); } diff --git a/src/globals.h b/src/globals.h index 228711695..549287a7a 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1237,10 +1237,13 @@ EXTERN guint32 gtk_socket_id INIT(= 0); EXTERN int echo_wid_arg INIT(= FALSE); /* --echo-wid argument */ #endif +#if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) +EXTERN int typebuf_was_filled INIT(= FALSE); /* received text from client + or from pushkeys() */ +#endif + #ifdef FEAT_CLIENTSERVER EXTERN char_u *serverName INIT(= NULL); /* name of the server */ -EXTERN int received_from_client INIT(= FALSE); /* received text from - client */ # ifdef FEAT_X11 EXTERN Window commWindow INIT(= None); EXTERN Window clientWindow INIT(= None); diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 3bec1f59f..68c0f3e63 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -3198,7 +3198,7 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event) /* The label size apparently doesn't include the spacing, estimate * it by the page position. */ if (page->allocation.x * 2 + label->allocation.x - + label->allocation.width + 1>= x) + + label->allocation.width + 1 >= x) break; } @@ -3652,6 +3652,7 @@ gui_mch_init(void) gtk_box_pack_start(GTK_BOX(vbox), gui.tabline, FALSE, FALSE, 0); gtk_notebook_set_show_border(GTK_NOTEBOOK(gui.tabline), FALSE); gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), FALSE); + gtk_notebook_set_scrollable(GTK_NOTEBOOK(gui.tabline), TRUE); { GtkWidget *page, *label; diff --git a/src/main.c b/src/main.c index 51cd2c724..276547bbc 100644 --- a/src/main.c +++ b/src/main.c @@ -3629,7 +3629,7 @@ server_to_input_buf(str) /* Let input_available() know we inserted text in the typeahead * buffer. */ - received_from_client = TRUE; + typebuf_was_filled = TRUE; } vim_free((char_u *)ptr); } diff --git a/src/os_mac.h b/src/os_mac.h index 22fd164d7..6effe1078 100644 --- a/src/os_mac.h +++ b/src/os_mac.h @@ -23,7 +23,7 @@ * files have many conflicts). */ #ifndef FEAT_X11 -# include <QuickDraw.h> +# include <Quickdraw.h> /* Apple calls it QuickDraw.h... */ # include <ToolUtils.h> # include <LowMem.h> # include <Scrap.h> diff --git a/src/proto/edit.pro b/src/proto/edit.pro index 819cc02eb..a967037cb 100644 --- a/src/proto/edit.pro +++ b/src/proto/edit.pro @@ -1,42 +1,41 @@ /* edit.c */ -extern int edit __ARGS((int cmdchar, int startln, long count)); -extern void edit_putchar __ARGS((int c, int highlight)); -extern void edit_unputchar __ARGS((void)); -extern void display_dollar __ARGS((colnr_T col)); -extern void change_indent __ARGS((int type, int amount, int round, int replaced)); -extern void truncate_spaces __ARGS((char_u *line)); -extern void backspace_until_column __ARGS((int col)); -extern int vim_is_ctrl_x_key __ARGS((int c)); -extern int ins_compl_add_infercase __ARGS((char_u *str, int len, int icase, char_u *fname, int dir, int flags)); -extern int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags)); -extern void set_completion __ARGS((int startcol, list_T *list)); -extern void ins_compl_show_pum __ARGS((void)); -extern char_u *find_word_start __ARGS((char_u *ptr)); -extern char_u *find_word_end __ARGS((char_u *ptr)); -extern int ins_compl_active __ARGS((void)); -extern int ins_compl_add_tv __ARGS((typval_T *tv, int dir)); -extern void ins_compl_check_keys __ARGS((int frequency)); -extern int get_literal __ARGS((void)); -extern void insertchar __ARGS((int c, int flags, int second_indent)); -extern void auto_format __ARGS((int trailblank, int prev_line)); -extern int comp_textwidth __ARGS((int ff)); -extern int stop_arrow __ARGS((void)); -extern void set_last_insert __ARGS((int c)); -extern void free_last_insert __ARGS((void)); -extern char_u *add_char2buf __ARGS((int c, char_u *s)); -extern void beginline __ARGS((int flags)); -extern int oneright __ARGS((void)); -extern int oneleft __ARGS((void)); -extern int cursor_up __ARGS((long n, int upd_topline)); -extern int cursor_down __ARGS((long n, int upd_topline)); -extern int stuff_inserted __ARGS((int c, long count, int no_esc)); -extern char_u *get_last_insert __ARGS((void)); -extern char_u *get_last_insert_save __ARGS((void)); -extern void replace_push __ARGS((int c)); -extern void fixthisline __ARGS((int (*get_the_indent)(void))); -extern void fix_indent __ARGS((void)); -extern int in_cinkeys __ARGS((int keytyped, int when, int line_is_empty)); -extern int hkmap __ARGS((int c)); -extern void ins_scroll __ARGS((void)); -extern void ins_horscroll __ARGS((void)); +int edit __ARGS((int cmdchar, int startln, long count)); +void edit_putchar __ARGS((int c, int highlight)); +void edit_unputchar __ARGS((void)); +void display_dollar __ARGS((colnr_T col)); +void change_indent __ARGS((int type, int amount, int round, int replaced)); +void truncate_spaces __ARGS((char_u *line)); +void backspace_until_column __ARGS((int col)); +int vim_is_ctrl_x_key __ARGS((int c)); +int ins_compl_add_infercase __ARGS((char_u *str, int len, int icase, char_u *fname, int dir, int flags)); +void set_completion __ARGS((int startcol, list_T *list)); +void ins_compl_show_pum __ARGS((void)); +char_u *find_word_start __ARGS((char_u *ptr)); +char_u *find_word_end __ARGS((char_u *ptr)); +int ins_compl_active __ARGS((void)); +int ins_compl_add_tv __ARGS((typval_T *tv, int dir)); +void ins_compl_check_keys __ARGS((int frequency)); +int get_literal __ARGS((void)); +void insertchar __ARGS((int c, int flags, int second_indent)); +void auto_format __ARGS((int trailblank, int prev_line)); +int comp_textwidth __ARGS((int ff)); +int stop_arrow __ARGS((void)); +void set_last_insert __ARGS((int c)); +void free_last_insert __ARGS((void)); +char_u *add_char2buf __ARGS((int c, char_u *s)); +void beginline __ARGS((int flags)); +int oneright __ARGS((void)); +int oneleft __ARGS((void)); +int cursor_up __ARGS((long n, int upd_topline)); +int cursor_down __ARGS((long n, int upd_topline)); +int stuff_inserted __ARGS((int c, long count, int no_esc)); +char_u *get_last_insert __ARGS((void)); +char_u *get_last_insert_save __ARGS((void)); +void replace_push __ARGS((int c)); +void fixthisline __ARGS((int (*get_the_indent)(void))); +void fix_indent __ARGS((void)); +int in_cinkeys __ARGS((int keytyped, int when, int line_is_empty)); +int hkmap __ARGS((int c)); +void ins_scroll __ARGS((void)); +void ins_horscroll __ARGS((void)); /* vim: set ft=c : */ diff --git a/src/version.h b/src/version.h index ef0ff31ce..e4bc3f666 100644 --- a/src/version.h +++ b/src/version.h @@ -35,6 +35,6 @@ */ #define VIM_VERSION_NODOT "vim70e" #define VIM_VERSION_SHORT "7.0e" -#define VIM_VERSION_MEDIUM "7.0e06 BETA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0e06 BETA (2006 Apr 22)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0e06 BETA (2006 Apr 22, compiled " +#define VIM_VERSION_MEDIUM "7.0e07 BETA" +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0e07 BETA (2006 Apr 23)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0e07 BETA (2006 Apr 23, compiled " |