From 6b161b638f90d6a2cb426a665003218fae50e428 Mon Sep 17 00:00:00 2001 From: edyfox Date: Thu, 4 Feb 2010 01:37:57 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@1752 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- src/ex_cmds2.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/ex_docmd.c | 5 ++++ src/ex_getln.c | 3 +++ src/fold.c | 8 +++++- src/getchar.c | 25 ++++++++++------- src/gui_w48.c | 10 +++++-- src/move.c | 11 ++++---- src/proto/ex_cmds2.pro | 2 ++ src/screen.c | 17 +++++++----- src/version.c | 12 +++++++++ src/vim.h | 1 + 11 files changed, 143 insertions(+), 24 deletions(-) diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 81feac83..94c1f74b 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1115,6 +1115,79 @@ ex_profile(eap) } } +/* Command line expansion for :profile. */ +static enum +{ + PEXP_SUBCMD, /* expand :profile sub-commands */ + PEXP_FUNC, /* expand :profile func {funcname} */ +} pexpand_what; + +static char *pexpand_cmds[] = { + "start", +#define PROFCMD_START 0 + "pause", +#define PROFCMD_PAUSE 1 + "continue", +#define PROFCMD_CONTINUE 2 + "func", +#define PROFCMD_FUNC 3 + "file", +#define PROFCMD_FILE 4 + NULL +#define PROFCMD_LAST 5 +}; + +/* + * Function given to ExpandGeneric() to obtain the profile command + * specific expansion. + */ + char_u * +get_profile_name(xp, idx) + expand_T *xp UNUSED; + int idx; +{ + switch (pexpand_what) + { + case PEXP_SUBCMD: + return (char_u *)pexpand_cmds[idx]; + /* case PEXP_FUNC: TODO */ + default: + return NULL; + } +} + +/* + * Handle command line completion for :profile command. + */ + void +set_context_in_profile_cmd(xp, arg) + expand_T *xp; + char_u *arg; +{ + char_u *end_subcmd; + int len; + + /* Default: expand subcommands. */ + xp->xp_context = EXPAND_PROFILE; + pexpand_what = PEXP_SUBCMD; + xp->xp_pattern = arg; + + end_subcmd = skiptowhite(arg); + if (*end_subcmd == NUL) + return; + + len = end_subcmd - arg; + if (len == 5 && STRNCMP(arg, "start", 5) == 0) + { + xp->xp_context = EXPAND_FILES; + xp->xp_pattern = skipwhite(end_subcmd); + return; + } + + /* TODO: expand function names after "func" */ + xp->xp_context = EXPAND_NOTHING; +} + /* * Dump the profiling info. */ diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 016a2b5e..aeb7774b 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -3804,6 +3804,11 @@ set_one_cmd_context(xp, buff) xp->xp_context = EXPAND_NOTHING; break; #endif +#if defined(FEAT_PROFILE) + case CMD_profile: + set_context_in_profile_cmd(xp, arg); + break; +#endif #endif /* FEAT_CMDL_COMPL */ diff --git a/src/ex_getln.c b/src/ex_getln.c index d5761f33..e8056f84 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4522,6 +4522,9 @@ ExpandFromContext(xp, pat, num_file, file, options) #ifdef FEAT_SIGNS {EXPAND_SIGN, get_sign_name, TRUE}, #endif +#ifdef FEAT_PROFILE + {EXPAND_PROFILE, get_profile_name, TRUE}, +#endif #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) {EXPAND_LANGUAGE, get_lang_arg, TRUE}, diff --git a/src/fold.c b/src/fold.c index 405a6ef1..ff1139dc 100644 --- a/src/fold.c +++ b/src/fold.c @@ -849,11 +849,17 @@ foldUpdate(wp, top, bot) fold_T *fp; /* Mark all folds from top to bot as maybe-small. */ - (void)foldFind(&curwin->w_folds, curwin->w_cursor.lnum, &fp); + (void)foldFind(&curwin->w_folds, top, &fp); while (fp < (fold_T *)curwin->w_folds.ga_data + curwin->w_folds.ga_len && fp->fd_top < bot) { fp->fd_small = MAYBE; + + /* Not sure if this is the right place to reset fd_flags (suggested by + * Lech Lorens). */ + if (wp->w_foldinvalid) + fp->fd_flags = FD_LEVEL; + ++fp; } diff --git a/src/getchar.c b/src/getchar.c index 99f7ddb0..d28eef5f 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2492,17 +2492,24 @@ vgetorpeek(advance) i = FAIL; else { - i = ins_typebuf(s, - save_m_noremap != REMAP_YES - ? save_m_noremap - : STRNCMP(s, + int noremap; + + if (save_m_noremap != REMAP_YES) + noremap = save_m_noremap; + else if ( #ifdef FEAT_EVAL - save_m_keys != NULL ? save_m_keys : + STRNCMP(s, save_m_keys != NULL + ? save_m_keys : mp->m_keys, + (size_t)keylen) +#else + STRNCMP(s, mp->m_keys, (size_t)keylen) #endif - mp->m_keys, - (size_t)keylen) != 0 - ? REMAP_YES : REMAP_SKIP, - 0, TRUE, cmd_silent || save_m_silent); + != 0) + noremap = REMAP_YES; + else + noremap = REMAP_SKIP; + i = ins_typebuf(s, noremap, + 0, TRUE, cmd_silent || save_m_silent); #ifdef FEAT_EVAL if (save_m_expr) vim_free(s); diff --git a/src/gui_w48.c b/src/gui_w48.c index 123584bb..40af60fa 100644 --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -1084,9 +1084,15 @@ _TextAreaWndProc( case WM_NOTIFY: Handle_WM_Notify(hwnd, (LPNMHDR)lParam); return TRUE; #endif + /* Workaround for the problem that MyWindowProc() returns FALSE on 64 + * bit windows when cross-compiled using Mingw libraries. (Andy + * Kittner) */ + case WM_NCCREATE: + MyWindowProc(hwnd, uMsg, wParam, lParam); + return TRUE; - default: - return MyWindowProc(hwnd, uMsg, wParam, lParam); + default: + return MyWindowProc(hwnd, uMsg, wParam, lParam); } } diff --git a/src/move.c b/src/move.c index 26ff3bf4..ad1f4d61 100644 --- a/src/move.c +++ b/src/move.c @@ -889,6 +889,7 @@ validate_cursor_col() { colnr_T off; colnr_T col; + int width; validate_virtcol(); if (!(curwin->w_valid & VALID_WCOL)) @@ -896,15 +897,14 @@ validate_cursor_col() col = curwin->w_virtcol; off = curwin_col_off(); col += off; + width = W_WIDTH(curwin) - off + curwin_col_off2(); /* long line wrapping, adjust curwin->w_wrow */ if (curwin->w_p_wrap && col >= (colnr_T)W_WIDTH(curwin) - && W_WIDTH(curwin) - off + curwin_col_off2() > 0) - { - col -= W_WIDTH(curwin); - col = col % (W_WIDTH(curwin) - off + curwin_col_off2()); - } + && width > 0) + /* use same formula as what is used in curs_columns() */ + col -= ((col - W_WIDTH(curwin)) / width + 1) * width; if (col > (int)curwin->w_leftcol) col -= curwin->w_leftcol; else @@ -1041,6 +1041,7 @@ curs_columns(scroll) /* long line wrapping, adjust curwin->w_wrow */ if (curwin->w_wcol >= W_WIDTH(curwin)) { + /* this same formula is used in validate_cursor_col() */ n = (curwin->w_wcol - W_WIDTH(curwin)) / width + 1; curwin->w_wcol -= n * width; curwin->w_wrow += n; diff --git a/src/proto/ex_cmds2.pro b/src/proto/ex_cmds2.pro index 88cfeb7a..2c89fe3f 100644 --- a/src/proto/ex_cmds2.pro +++ b/src/proto/ex_cmds2.pro @@ -24,6 +24,8 @@ void profile_sub_wait __ARGS((proftime_T *tm, proftime_T *tma)); int profile_equal __ARGS((proftime_T *tm1, proftime_T *tm2)); int profile_cmp __ARGS((proftime_T *tm1, proftime_T *tm2)); void ex_profile __ARGS((exarg_T *eap)); +char_u *get_profile_name __ARGS((expand_T *xp, int idx)); +void set_context_in_profile_cmd __ARGS((expand_T *xp, char_u *arg)); void profile_dump __ARGS((void)); void script_prof_save __ARGS((proftime_T *tm)); void script_prof_restore __ARGS((proftime_T *tm)); diff --git a/src/screen.c b/src/screen.c index d461cede..7cd72bdc 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2335,13 +2335,12 @@ fold_line(wp, fold_count, foldinfo, lnum, row) if (cells > 1) ScreenLines[idx + 1] = 0; } - else if (cells > 1) /* double-byte character */ - { - if (enc_dbcs == DBCS_JPNU && *p == 0x8e) - ScreenLines2[idx] = p[1]; - else - ScreenLines[idx + 1] = p[1]; - } + else if (enc_dbcs == DBCS_JPNU && *p == 0x8e) + /* double-byte single width character */ + ScreenLines2[idx] = p[1]; + else if (cells > 1) + /* double-width character */ + ScreenLines[idx + 1] = p[1]; col += cells; idx += cells; p += c_len; @@ -4631,7 +4630,11 @@ win_line(wp, lnum, startrow, endrow, nochange) ScreenLines[off] = c; #ifdef FEAT_MBYTE if (enc_dbcs == DBCS_JPNU) + { + if ((mb_c & 0xff00) == 0x8e00) + ScreenLines[off] = 0x8e; ScreenLines2[off] = mb_c & 0xff; + } else if (enc_utf8) { if (mb_utf8) diff --git a/src/version.c b/src/version.c index 7e39961a..b7aacc13 100644 --- a/src/version.c +++ b/src/version.c @@ -682,6 +682,18 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 356, +/**/ + 355, +/**/ + 354, +/**/ + 353, +/**/ + 352, +/**/ + 351, +/**/ 350, /**/ 349, diff --git a/src/vim.h b/src/vim.h index 88541e5f..804070ef 100644 --- a/src/vim.h +++ b/src/vim.h @@ -718,6 +718,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EXPAND_SHELLCMD 32 #define EXPAND_CSCOPE 33 #define EXPAND_SIGN 34 +#define EXPAND_PROFILE 35 /* Values for exmode_active (0 is no exmode) */ #define EXMODE_NORMAL 1 -- 2.11.4.GIT