From a8f8a3ed007d280c9dba21bc3626518a831f5808 Mon Sep 17 00:00:00 2001 From: edyfox Date: Thu, 12 Nov 2009 04:45:55 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1656 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- runtime/doc/eval.txt | 1 + runtime/doc/starting.txt | 7 ++++--- runtime/doc/various.txt | 1 + src/edit.c | 2 +- src/eval.c | 3 +++ src/getchar.c | 10 +++++----- src/if_perl.xs | 3 ++- src/if_python.c | 6 ++++++ src/main.c | 31 ++++++++++++++++++++----------- src/misc1.c | 6 ++++-- src/misc2.c | 17 +++++++++++------ src/ops.c | 3 ++- src/screen.c | 3 ++- src/version.c | 23 +++++++++++++++++++++++ 14 files changed, 85 insertions(+), 31 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 6a57ae52..ba498af2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -5869,6 +5869,7 @@ showcmd Compiled with 'showcmd' support. signs Compiled with |:sign| support. smartindent Compiled with 'smartindent' support. sniff Compiled with SNiFF interface support. +startuptime Compiled with |--startuptime| support. statusline Compiled with support for 'statusline', 'rulerformat' and special formats of 'titlestring' and 'iconstring'. sun_workshop Compiled with support for Sun |workshop|. diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index c1ed1b80..4c126516 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -144,12 +144,13 @@ a slash. Thus "-R" means recovery and "-/R" readonly. -u NORC no yes --noplugin yes no ---startuptime={fname} *--startuptime* +--startuptime {fname} *--startuptime* During startup write timing messages to the file {fname}. This can be used to find out where time is spent while loading - your .vimrc and plugins. + your .vimrc, plugins and opening the first file. When {fname} already exists new messages are appended. - {only when compiled with this feature} + (Only available when compiled with the |+startuptime| + feature). *--literal* --literal Take file names literally, don't expand wildcards. Not needed diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index ffb9f268..1755e4ca 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -374,6 +374,7 @@ N *+scrollbind* |'scrollbind'| B *+signs* |:sign| N *+smartindent* |'smartindent'| m *+sniff* SniFF interface |sniff| +N *+startuptime* |--startuptime| argument N *+statusline* Options 'statusline', 'rulerformat' and special formats of 'titlestring' and 'iconstring' m *+sun_workshop* |workshop| diff --git a/src/edit.c b/src/edit.c index 347571f4..d825d83e 100644 --- a/src/edit.c +++ b/src/edit.c @@ -8519,7 +8519,7 @@ ins_bs(c, mode, inserted_space_p) { save_col = curwin->w_cursor.col; beginline(BL_WHITE); - if (curwin->w_cursor.col < (colnr_T)temp) + if (curwin->w_cursor.col < save_col) mincol = curwin->w_cursor.col; curwin->w_cursor.col = save_col; } diff --git a/src/eval.c b/src/eval.c index aff6152e..40fcfefb 100644 --- a/src/eval.c +++ b/src/eval.c @@ -11736,6 +11736,9 @@ f_has(argvars, rettv) #ifdef FEAT_SNIFF "sniff", #endif +#ifdef STARTUPTIME + "startuptime", +#endif #ifdef FEAT_STL_OPT "statusline", #endif diff --git a/src/getchar.c b/src/getchar.c index b39ff74a..f4ad8d2a 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -22,7 +22,7 @@ * These buffers are used for storing: * - stuffed characters: A command that is translated into another command. * - redo characters: will redo the last change. - * - recorded chracters: for the "q" command. + * - recorded characters: for the "q" command. * * The bytes are stored like in the typeahead buffer: * - K_SPECIAL introduces a special key (two more bytes follow). A literal @@ -1283,7 +1283,7 @@ free_typebuf() EMSG2(_(e_intern2), "Free typebuf 1"); else vim_free(typebuf.tb_buf); - if (typebuf.tb_buf == noremapbuf_init) + if (typebuf.tb_noremap == noremapbuf_init) EMSG2(_(e_intern2), "Free typebuf 2"); else vim_free(typebuf.tb_noremap); @@ -1516,7 +1516,7 @@ updatescript(c) * wanted. * This translates escaped K_SPECIAL and CSI bytes to a K_SPECIAL or CSI byte. * Collects the bytes of a multibyte character into the whole character. - * Returns the modifers in the global "mod_mask". + * Returns the modifiers in the global "mod_mask". */ int vgetc() @@ -3320,7 +3320,7 @@ do_map(maptype, arg, mode, abbrev) retval = 1; goto theend; } - /* An abbrevation cannot contain white space. */ + /* An abbreviation cannot contain white space. */ for (n = 0; n < len; ++n) if (vim_iswhite(keys[n])) { @@ -4272,7 +4272,7 @@ check_abbr(c, ptr, col, mincol) /* * Check for word before the cursor: If it ends in a keyword char all - * chars before it must be al keyword chars or non-keyword chars, but not + * chars before it must be keyword chars or non-keyword chars, but not * white space. If it ends in a non-keyword char we accept any characters * before it except white space. */ diff --git a/src/if_perl.xs b/src/if_perl.xs index 926adcef..1ef0eb4a 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -720,8 +720,9 @@ ex_perl(eap) #ifdef HAVE_SANDBOX if (sandbox) { + safe = perl_get_sv( "VIM::safe", FALSE ); # ifndef MAKE_TEST /* avoid a warning for unreachable code */ - if ((safe = perl_get_sv( "VIM::safe", FALSE )) == NULL || !SvTRUE(safe)) + if (safe == NULL || !SvTRUE(safe)) EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); else # endif diff --git a/src/if_python.c b/src/if_python.c index b9a12fa2..c9ebf131 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -37,6 +37,12 @@ #ifdef HAVE_STDARG_H # undef HAVE_STDARG_H /* Python's config.h defines it as well. */ #endif +#ifdef _POSIX_C_SOURCE +# undef _POSIX_C_SOURCE /* pyconfig.h defines it as well. */ +#endif +#ifdef _XOPEN_SOURCE +# undef _XOPEN_SOURCE /* pyconfig.h defines it as well. */ +#endif #define PY_SSIZE_T_CLEAN diff --git a/src/main.c b/src/main.c index 5bb81a60..13707ce1 100644 --- a/src/main.c +++ b/src/main.c @@ -204,9 +204,9 @@ main #ifdef STARTUPTIME for (i = 1; i < argc; ++i) { - if (STRNICMP(argv[i], "--startuptime=", 14) == 0) + if (STRICMP(argv[i], "--startuptime") == 0 && i + 1 < argc) { - time_fd = mch_fopen(argv[i] + 14, "a"); + time_fd = mch_fopen(argv[i + 1], "a"); TIME_MSG("--- VIM STARTING ---"); break; } @@ -1726,6 +1726,11 @@ command_line_scan(parmp) want_argument = TRUE; argv_idx += 3; } + else if (STRNICMP(argv[0] + argv_idx, "startuptime", 11) == 0) + { + want_argument = TRUE; + argv_idx += 11; + } #ifdef FEAT_CLIENTSERVER else if (STRNICMP(argv[0] + argv_idx, "serverlist", 10) == 0) ; /* already processed -- no arg */ @@ -1761,10 +1766,6 @@ command_line_scan(parmp) /* already processed, skip */ } #endif - else if (STRNICMP(argv[0] + argv_idx, "startuptime", 11) == 0) - { - /* already processed, skip */ - } else { if (argv[0][argv_idx]) @@ -2061,7 +2062,7 @@ command_line_scan(parmp) mainerr(ME_GARBAGE, (char_u *)argv[0]); --argc; - if (argc < 1 && c != 'S') + if (argc < 1 && c != 'S') /* -S has an optional argument */ mainerr_arg_missing((char_u *)argv[0]); ++argv; argv_idx = -1; @@ -2102,11 +2103,16 @@ command_line_scan(parmp) (char_u *)argv[0]; break; - case '-': /* "--cmd {command}" execute command */ - if (parmp->n_pre_commands >= MAX_ARG_CMDS) - mainerr(ME_EXTRA_CMD, NULL); - parmp->pre_commands[parmp->n_pre_commands++] = + case '-': + if (argv[-1][2] == 'c') + { + /* "--cmd {command}" execute command */ + if (parmp->n_pre_commands >= MAX_ARG_CMDS) + mainerr(ME_EXTRA_CMD, NULL); + parmp->pre_commands[parmp->n_pre_commands++] = (char_u *)argv[0]; + } + /* "--startuptime " already handled */ break; /* case 'd': -d {device} is handled in mch_check_win() for the @@ -3144,6 +3150,9 @@ usage() main_msg(_("--serverlist\t\tList available Vim server names and exit")); main_msg(_("--servername \tSend to/become the Vim server ")); #endif +#ifdef STARTUPTIME + main_msg(_("--startuptime=\tWrite startup timing messages to ")); +#endif #ifdef FEAT_VIMINFO main_msg(_("-i \t\tUse instead of .viminfo")); #endif diff --git a/src/misc1.c b/src/misc1.c index bb15d429..f7da7c49 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -1026,12 +1026,14 @@ open_line(dir, flags, old_indent) int c = 0; int off = 0; - for (p = lead_flags; *p && *p != ':'; ++p) + for (p = lead_flags; *p != NUL && *p != ':'; ) { if (*p == COM_RIGHT || *p == COM_LEFT) - c = *p; + c = *p++; else if (VIM_ISDIGIT(*p) || *p == '-') off = getdigits(&p); + else + ++p; } if (c == COM_RIGHT) /* right adjusted leader */ { diff --git a/src/misc2.c b/src/misc2.c index 5fc64bb8..ec3849f5 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1005,9 +1005,14 @@ free_all_mem() # ifdef FEAT_MENU /* Clear menus. */ do_cmdline_cmd((char_u *)"aunmenu *"); +# ifdef FEAT_MULTI_LANG + do_cmdline_cmd((char_u *)"menutranslate clear"); +# endif # endif /* Clear mappings, abbreviations, breakpoints. */ + do_cmdline_cmd((char_u *)"lmapclear"); + do_cmdline_cmd((char_u *)"xmapclear"); do_cmdline_cmd((char_u *)"mapclear"); do_cmdline_cmd((char_u *)"mapclear!"); do_cmdline_cmd((char_u *)"abclear"); @@ -1282,7 +1287,7 @@ csh_like_shell() /* * Escape "string" for use as a shell argument with system(). - * This uses single quotes, except when we know we need to use double qoutes + * This uses single quotes, except when we know we need to use double quotes * (MS-DOS and MS-Windows without 'shellslash' set). * Escape a newline, depending on the 'shell' option. * When "do_special" is TRUE also replace "!", "%", "#" and things starting @@ -1537,7 +1542,7 @@ copy_spaces(ptr, count) #if defined(FEAT_VISUALEXTRA) || defined(PROTO) /* * Copy a character a number of times. - * Does not work for multi-byte charactes! + * Does not work for multi-byte characters! */ void copy_chars(ptr, count, c) @@ -4260,7 +4265,7 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what, * or '**76' is transposed to '**N'( 'N' is ASCII value 76). * For EBCDIC you get different character values. * If no restrict is given after '**' the default is used. - * Due to this technic the path looks awful if you print it as a + * Due to this technique the path looks awful if you print it as a * string. */ len = 0; @@ -4649,7 +4654,7 @@ vim_findfile(search_ctx_arg) && !mch_isdir(stackp->ffs_filearray[i])) continue; /* not a directory */ - /* prepare the filename to be checked for existance + /* prepare the filename to be checked for existence * below */ STRCPY(file_path, stackp->ffs_filearray[i]); add_pathsep(file_path); @@ -5438,7 +5443,7 @@ find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_f #if defined(MSWIN) || defined(MSDOS) || defined(OS2) /* handle "\tmp" as absolute path */ || vim_ispathsep(ff_file_to_find[0]) - /* handle "c:name" as absulute path */ + /* handle "c:name" as absolute path */ || (ff_file_to_find[0] != NUL && ff_file_to_find[1] == ':') #endif #ifdef AMIGA @@ -5681,7 +5686,7 @@ qsort(base, elm_count, elm_size, cmp) p2 = (char_u *)base + (j + gap) * elm_size; if ((*cmp)((void *)p1, (void *)p2) <= 0) break; - /* Exchange the elemets. */ + /* Exchange the elements. */ mch_memmove(buf, p1, elm_size); mch_memmove(p1, p2, elm_size); mch_memmove(p2, buf, elm_size); diff --git a/src/ops.c b/src/ops.c index e5db3134..fbac2c24 100644 --- a/src/ops.c +++ b/src/ops.c @@ -422,8 +422,9 @@ shift_block(oap, amount) #ifdef FEAT_MBYTE if (has_mbyte) bd.textstart += (*mb_ptr2len)(bd.textstart); + else #endif - ++bd.textstart; + ++bd.textstart; } for ( ; vim_iswhite(*bd.textstart); ) { diff --git a/src/screen.c b/src/screen.c index b7107b62..5acc7dc4 100644 --- a/src/screen.c +++ b/src/screen.c @@ -6413,7 +6413,8 @@ screen_puts_len(text, len, row, col, attr) } else { - nc = utfc_ptr2char(ptr + mbyte_blen, pcc); + nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc, + (int)((text + len) - ptr - mbyte_blen)); nc1 = pcc[0]; } pc = prev_c; diff --git a/src/version.c b/src/version.c index 8a71cbe3..2ee84208 100644 --- a/src/version.c +++ b/src/version.c @@ -494,6 +494,11 @@ static char *(features[]) = #else "-sniff", #endif +#ifdef STARTUPTIME + "+startuptime", +#else + "-startuptime", +#endif #ifdef FEAT_STL_OPT "+statusline", #else @@ -677,6 +682,24 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 293, +/**/ + 292, +/**/ + 291, +/**/ + 290, +/**/ + 289, +/**/ + 288, +/**/ + 287, +/**/ + 286, +/**/ + 285, +/**/ 284, /**/ 283, -- 2.11.4.GIT