diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-03-20 21:47:49 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-03-20 21:47:49 +0000 |
commit | 371d5403d0dc6411f6f17c5b472c1cfcac6789e4 (patch) | |
tree | 08066b3d097303df50e1b67fffc33d1d68bcb0d4 /src | |
parent | ceaf7b8b66764b4a99526c715886d80397ce81dd (diff) | |
download | vim-git-371d5403d0dc6411f6f17c5b472c1cfcac6789e4.tar.gz |
updated for version 7.0230
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer.c | 3 | ||||
-rw-r--r-- | src/ex_docmd.c | 25 | ||||
-rw-r--r-- | src/fileio.c | 4 | ||||
-rw-r--r-- | src/getchar.c | 130 | ||||
-rw-r--r-- | src/gui.c | 32 | ||||
-rw-r--r-- | src/vim.h | 7 | ||||
-rw-r--r-- | src/window.c | 9 |
7 files changed, 145 insertions, 65 deletions
diff --git a/src/buffer.c b/src/buffer.c index 7e848f6ff..37238636b 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1689,6 +1689,9 @@ free_buf_options(buf, free_p_ff) clear_string_option(&buf->b_p_inde); clear_string_option(&buf->b_p_indk); #endif +#if defined(FEAT_BEVAL) && defined(FEAT_EVAL) + clear_string_option(&buf->b_p_bexpr); +#endif #if defined(FEAT_EVAL) clear_string_option(&buf->b_p_fex); #endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c index cfb55df7e..dbab4e2d0 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -900,7 +900,7 @@ do_cmdline(cmdline, getline, cookie, flags) if (getline_is_func) { # ifdef FEAT_PROFILE - if (do_profiling) + if (do_profiling == PROF_YES) func_line_end(real_cookie); # endif if (func_has_ended(real_cookie)) @@ -910,7 +910,7 @@ do_cmdline(cmdline, getline, cookie, flags) } } #ifdef FEAT_PROFILE - else if (do_profiling + else if (do_profiling == PROF_YES && getline_equal(getline, cookie, getsourceline)) script_line_end(); #endif @@ -947,7 +947,7 @@ do_cmdline(cmdline, getline, cookie, flags) *dbg_tick = debug_tick; } # ifdef FEAT_PROFILE - if (do_profiling) + if (do_profiling == PROF_YES) { if (getline_is_func) func_line_start(real_cookie); @@ -1912,7 +1912,7 @@ do_one_cmd(cmdlinep, sourcing, #ifdef FEAT_EVAL # ifdef FEAT_PROFILE /* Count this line for profiling if ea.skip is FALSE. */ - if (do_profiling && !ea.skip) + if (do_profiling == PROF_YES && !ea.skip) { if (getline_equal(getline, cookie, get_func_line)) func_line_exec(getline_cookie(getline, cookie)); @@ -5633,21 +5633,22 @@ uc_check_code(code, len, buf, cmd, eap, split_buf, split_len) l -= 2; } - if (l < 1) + ++l; + if (l <= 1) type = ct_NONE; - else if (STRNICMP(p, "args", l) == 0) + else if (STRNICMP(p, "args>", l) == 0) type = ct_ARGS; - else if (STRNICMP(p, "bang", l) == 0) + else if (STRNICMP(p, "bang>", l) == 0) type = ct_BANG; - else if (STRNICMP(p, "count", l) == 0) + else if (STRNICMP(p, "count>", l) == 0) type = ct_COUNT; - else if (STRNICMP(p, "line1", l) == 0) + else if (STRNICMP(p, "line1>", l) == 0) type = ct_LINE1; - else if (STRNICMP(p, "line2", l) == 0) + else if (STRNICMP(p, "line2>", l) == 0) type = ct_LINE2; - else if (STRNICMP(p, "lt", l) == 0) + else if (STRNICMP(p, "lt>", l) == 0) type = ct_LT; - else if (STRNICMP(p, "register", l) == 0) + else if (STRNICMP(p, "reg>", l) == 0 || STRNICMP(p, "register>", l) == 0) type = ct_REGISTER; switch (type) diff --git a/src/fileio.c b/src/fileio.c index 5dd502c82..a5fdfb71d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -8518,7 +8518,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) save_current_SID = current_SID; # ifdef FEAT_PROFILE - if (do_profiling) + if (do_profiling == PROF_YES) prof_child_enter(&wait_time); /* doesn't count for the caller itself */ # endif @@ -8614,7 +8614,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) current_SID = save_current_SID; restore_funccal(save_funccalp); # ifdef FEAT_PROFILE - if (do_profiling) + if (do_profiling == PROF_YES) prof_child_exit(&wait_time); # endif #endif diff --git a/src/getchar.c b/src/getchar.c index 9810ed4b9..e941f94b3 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -63,7 +63,7 @@ static int block_redo = FALSE; * Returns a value between 0 and 255, index in maphash. * Put Normal/Visual mode mappings mostly separately from Insert/Cmdline mode. */ -#define MAP_HASH(mode, c1) (((mode) & (NORMAL + VISUAL + OP_PENDING)) ? (c1) : ((c1) ^ 0x80)) +#define MAP_HASH(mode, c1) (((mode) & (NORMAL + VISUAL + SELECTMODE + OP_PENDING)) ? (c1) : ((c1) ^ 0x80)) /* * Each mapping is put in one of the 256 hash lists, to speed up finding it. @@ -2236,12 +2236,13 @@ vgetorpeek(advance) { # ifdef FEAT_VISUAL /* - * In Select mode, a Visual mode menu is - * used. Switch to Visual mode + * In Select mode and a Visual mode menu + * is used: Switch to Visual mode * temporarily. Append K_SELECT to switch * back to Select mode. */ - if (VIsual_active && VIsual_select) + if (VIsual_active && VIsual_select + && (current_menu->modes & VISUAL)) { VIsual_select = FALSE; (void)ins_typebuf(K_SELECT_STRING, @@ -2297,11 +2298,12 @@ vgetorpeek(advance) #ifdef FEAT_VISUAL /* - * In Select mode, a Visual mode mapping is used. + * In Select mode and a Visual mode mapping is used: * Switch to Visual mode temporarily. Append K_SELECT * to switch back to Select mode. */ - if (VIsual_active && VIsual_select) + if (VIsual_active && VIsual_select + && (mp->m_mode & VISUAL)) { VIsual_select = FALSE; (void)ins_typebuf(K_SELECT_STRING, REMAP_NONE, @@ -2926,13 +2928,15 @@ input_available() * arg is pointer to any arguments. Note: arg cannot be a read-only string, * it will be modified. * - * for :map mode is NORMAL + VISUAL + OP_PENDING + * for :map mode is NORMAL + VISUAL + SELECTMODE + OP_PENDING * for :map! mode is INSERT + CMDLINE * for :cmap mode is CMDLINE * for :imap mode is INSERT * for :lmap mode is LANGMAP * for :nmap mode is NORMAL - * for :vmap mode is VISUAL + * for :vmap mode is VISUAL + SELECTMODE + * for :xmap mode is VISUAL + * for :smap mode is SELECTMODE * for :omap mode is OP_PENDING * * for :abbr mode is INSERT + CMDLINE @@ -3524,7 +3528,11 @@ get_map_mode(cmdp, forceit) else if (modec == 'n' && *p != 'o') /* avoid :noremap */ mode = NORMAL; /* :nmap */ else if (modec == 'v') - mode = VISUAL; /* :vmap */ + mode = VISUAL + SELECTMODE; /* :vmap */ + else if (modec == 'x') + mode = VISUAL; /* :xmap */ + else if (modec == 's') + mode = SELECTMODE; /* :smap */ else if (modec == 'o') mode = OP_PENDING; /* :omap */ else @@ -3533,7 +3541,7 @@ get_map_mode(cmdp, forceit) if (forceit) mode = INSERT + CMDLINE; /* :map ! */ else - mode = VISUAL + NORMAL + OP_PENDING;/* :map */ + mode = VISUAL + SELECTMODE + NORMAL + OP_PENDING;/* :map */ } *cmdp = p; @@ -3668,8 +3676,8 @@ showmap(mp, local) msg_putchar('l'); /* :lmap */ else if (mp->m_mode & CMDLINE) msg_putchar('c'); /* :cmap */ - else if ((mp->m_mode & (NORMAL + VISUAL + OP_PENDING)) - == NORMAL + VISUAL + OP_PENDING) + else if ((mp->m_mode & (NORMAL + VISUAL + SELECTMODE + OP_PENDING)) + == NORMAL + VISUAL + SELECTMODE + OP_PENDING) msg_putchar(' '); /* :map */ else { @@ -3684,11 +3692,24 @@ showmap(mp, local) msg_putchar('o'); /* :omap */ ++len; } - if (mp->m_mode & VISUAL) + if ((mp->m_mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE) { msg_putchar('v'); /* :vmap */ ++len; } + else + { + if (mp->m_mode & VISUAL) + { + msg_putchar('x'); /* :xmap */ + ++len; + } + if (mp->m_mode & SELECTMODE) + { + msg_putchar('s'); /* :smap */ + ++len; + } + } } while (++len <= 3) msg_putchar(' '); @@ -3749,7 +3770,11 @@ map_to_exists(str, modechars, abbr) if (vim_strchr(modechars, 'n') != NULL) mode |= NORMAL; if (vim_strchr(modechars, 'v') != NULL) + mode |= VISUAL + SELECTMODE; + if (vim_strchr(modechars, 'x') != NULL) mode |= VISUAL; + if (vim_strchr(modechars, 's') != NULL) + mode |= SELECTMODE; if (vim_strchr(modechars, 'o') != NULL) mode |= OP_PENDING; if (vim_strchr(modechars, 'i') != NULL) @@ -3857,7 +3882,7 @@ set_context_in_map_cmd(xp, cmd, arg, forceit, isabbrev, isunmap, cmdidx) { expand_mapmodes = INSERT + CMDLINE; if (!isabbrev) - expand_mapmodes += VISUAL + NORMAL + OP_PENDING; + expand_mapmodes += VISUAL + SELECTMODE + NORMAL + OP_PENDING; } expand_isabbrev = isabbrev; xp->xp_context = EXPAND_MAPPINGS; @@ -4310,22 +4335,28 @@ makemap(fd, buf) cmd = "map"; switch (mp->m_mode) { - case NORMAL + VISUAL + OP_PENDING: + case NORMAL + VISUAL + SELECTMODE + OP_PENDING: break; case NORMAL: c1 = 'n'; break; - case VISUAL: + case VISUAL + SELECTMODE: c1 = 'v'; break; + case VISUAL: + c1 = 'x'; + break; + case SELECTMODE: + c1 = 's'; + break; case OP_PENDING: c1 = 'o'; break; - case NORMAL + VISUAL: + case NORMAL + VISUAL + SELECTMODE: c1 = 'n'; c2 = 'v'; break; - case VISUAL + OP_PENDING: + case VISUAL + SELECTMODE + OP_PENDING: c1 = 'v'; c2 = 'o'; break; @@ -4697,6 +4728,9 @@ check_map(keys, mode, exact, ign_mod, abbr) #endif #if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) + +#define VIS_SEL (VISUAL+SELECTMODE) /* abbreviation */ + /* * Default mappings for some often used keys. */ @@ -4709,58 +4743,58 @@ static struct initmap #if defined(MSDOS) || defined(MSWIN) || defined(OS2) /* Use the Windows (CUA) keybindings. */ # ifdef FEAT_GUI - {(char_u *)"<C-PageUp> H", NORMAL+VISUAL}, + {(char_u *)"<C-PageUp> H", NORMAL+VIS_SEL}, {(char_u *)"<C-PageUp> <C-O>H",INSERT}, - {(char_u *)"<C-PageDown> L$", NORMAL+VISUAL}, + {(char_u *)"<C-PageDown> L$", NORMAL+VIS_SEL}, {(char_u *)"<C-PageDown> <C-O>L<C-O>$", INSERT}, /* paste, copy and cut */ {(char_u *)"<S-Insert> \"*P", NORMAL}, - {(char_u *)"<S-Insert> \"-d\"*P", VISUAL}, + {(char_u *)"<S-Insert> \"-d\"*P", VIS_SEL}, {(char_u *)"<S-Insert> <C-R><C-O>*", INSERT+CMDLINE}, - {(char_u *)"<C-Insert> \"*y", VISUAL}, - {(char_u *)"<S-Del> \"*d", VISUAL}, - {(char_u *)"<C-Del> \"*d", VISUAL}, - {(char_u *)"<C-X> \"*d", VISUAL}, + {(char_u *)"<C-Insert> \"*y", VIS_SEL}, + {(char_u *)"<S-Del> \"*d", VIS_SEL}, + {(char_u *)"<C-Del> \"*d", VIS_SEL}, + {(char_u *)"<C-X> \"*d", VIS_SEL}, /* Missing: CTRL-C (cancel) and CTRL-V (block selection) */ # else - {(char_u *)"\316\204 H", NORMAL+VISUAL}, /* CTRL-PageUp is "H" */ + {(char_u *)"\316\204 H", NORMAL+VIS_SEL}, /* CTRL-PageUp is "H" */ {(char_u *)"\316\204 \017H",INSERT}, /* CTRL-PageUp is "^OH"*/ - {(char_u *)"\316v L$", NORMAL+VISUAL}, /* CTRL-PageDown is "L$" */ + {(char_u *)"\316v L$", NORMAL+VIS_SEL}, /* CTRL-PageDown is "L$" */ {(char_u *)"\316v \017L\017$", INSERT}, /* CTRL-PageDown ="^OL^O$"*/ - {(char_u *)"\316w <C-Home>", NORMAL+VISUAL}, + {(char_u *)"\316w <C-Home>", NORMAL+VIS_SEL}, {(char_u *)"\316w <C-Home>", INSERT+CMDLINE}, - {(char_u *)"\316u <C-End>", NORMAL+VISUAL}, + {(char_u *)"\316u <C-End>", NORMAL+VIS_SEL}, {(char_u *)"\316u <C-End>", INSERT+CMDLINE}, /* paste, copy and cut */ # ifdef FEAT_CLIPBOARD # ifdef DJGPP {(char_u *)"\316\122 \"*P", NORMAL}, /* SHIFT-Insert is "*P */ - {(char_u *)"\316\122 \"-d\"*P", VISUAL}, /* SHIFT-Insert is "-d"*P */ + {(char_u *)"\316\122 \"-d\"*P", VIS_SEL}, /* SHIFT-Insert is "-d"*P */ {(char_u *)"\316\122 \022\017*", INSERT}, /* SHIFT-Insert is ^R^O* */ - {(char_u *)"\316\222 \"*y", VISUAL}, /* CTRL-Insert is "*y */ + {(char_u *)"\316\222 \"*y", VIS_SEL}, /* CTRL-Insert is "*y */ # if 0 /* Shift-Del produces the same code as Del */ - {(char_u *)"\316\123 \"*d", VISUAL}, /* SHIFT-Del is "*d */ + {(char_u *)"\316\123 \"*d", VIS_SEL}, /* SHIFT-Del is "*d */ # endif - {(char_u *)"\316\223 \"*d", VISUAL}, /* CTRL-Del is "*d */ - {(char_u *)"\030 \"-d", VISUAL}, /* CTRL-X is "-d */ + {(char_u *)"\316\223 \"*d", VIS_SEL}, /* CTRL-Del is "*d */ + {(char_u *)"\030 \"-d", VIS_SEL}, /* CTRL-X is "-d */ # else {(char_u *)"\316\324 \"*P", NORMAL}, /* SHIFT-Insert is "*P */ - {(char_u *)"\316\324 \"-d\"*P", VISUAL}, /* SHIFT-Insert is "-d"*P */ + {(char_u *)"\316\324 \"-d\"*P", VIS_SEL}, /* SHIFT-Insert is "-d"*P */ {(char_u *)"\316\324 \022\017*", INSERT}, /* SHIFT-Insert is ^R^O* */ - {(char_u *)"\316\325 \"*y", VISUAL}, /* CTRL-Insert is "*y */ - {(char_u *)"\316\327 \"*d", VISUAL}, /* SHIFT-Del is "*d */ - {(char_u *)"\316\330 \"*d", VISUAL}, /* CTRL-Del is "*d */ - {(char_u *)"\030 \"-d", VISUAL}, /* CTRL-X is "-d */ + {(char_u *)"\316\325 \"*y", VIS_SEL}, /* CTRL-Insert is "*y */ + {(char_u *)"\316\327 \"*d", VIS_SEL}, /* SHIFT-Del is "*d */ + {(char_u *)"\316\330 \"*d", VIS_SEL}, /* CTRL-Del is "*d */ + {(char_u *)"\030 \"-d", VIS_SEL}, /* CTRL-X is "-d */ # endif # else {(char_u *)"\316\324 P", NORMAL}, /* SHIFT-Insert is P */ - {(char_u *)"\316\324 \"-dP", VISUAL}, /* SHIFT-Insert is "-dP */ + {(char_u *)"\316\324 \"-dP", VIS_SEL}, /* SHIFT-Insert is "-dP */ {(char_u *)"\316\324 \022\017\"", INSERT}, /* SHIFT-Insert is ^R^O" */ - {(char_u *)"\316\325 y", VISUAL}, /* CTRL-Insert is y */ - {(char_u *)"\316\327 d", VISUAL}, /* SHIFT-Del is d */ - {(char_u *)"\316\330 d", VISUAL}, /* CTRL-Del is d */ + {(char_u *)"\316\325 y", VIS_SEL}, /* CTRL-Insert is y */ + {(char_u *)"\316\327 d", VIS_SEL}, /* SHIFT-Del is d */ + {(char_u *)"\316\330 d", VIS_SEL}, /* CTRL-Del is d */ # endif # endif #endif @@ -4769,13 +4803,15 @@ static struct initmap /* Use the Standard MacOS binding. */ /* paste, copy and cut */ {(char_u *)"<D-v> \"*P", NORMAL}, - {(char_u *)"<D-v> \"-d\"*P", VISUAL}, + {(char_u *)"<D-v> \"-d\"*P", VIS_SEL}, {(char_u *)"<D-v> <C-R>*", INSERT+CMDLINE}, - {(char_u *)"<D-c> \"*y", VISUAL}, - {(char_u *)"<D-x> \"*d", VISUAL}, - {(char_u *)"<Backspace> \"-d", VISUAL}, + {(char_u *)"<D-c> \"*y", VIS_SEL}, + {(char_u *)"<D-x> \"*d", VIS_SEL}, + {(char_u *)"<Backspace> \"-d", VIS_SEL}, #endif }; + +# undef VIS_SEL #endif /* @@ -2802,6 +2802,7 @@ button_set: case OP_PENDING: case NORMAL: checkfor = MOUSE_NORMAL; break; case VISUAL: checkfor = MOUSE_VISUAL; break; + case SELECTMODE: checkfor = MOUSE_VISUAL; break; case REPLACE: case REPLACE+LANGMAP: #ifdef FEAT_VREPLACE @@ -3077,7 +3078,9 @@ gui_menu_cb(menu) } #endif -static int prev_which_scrollbars[3] = {-1, -1, -1}; +#ifndef FEAT_WINDOWS +static int prev_which_scrollbars[3]; +#endif /* * Set which components are present. @@ -3211,7 +3214,13 @@ gui_init_which_components(oldval) for (i = 0; i < 3; i++) { - if (gui.which_scrollbars[i] != prev_which_scrollbars[i]) + if (gui.which_scrollbars[i] != +#ifdef FEAT_WINDOWS + curtab->tp_prev_which_scrollbars[i] +#else + prev_which_scrollbars[i] +#endif + ) { if (i == SBAR_BOTTOM) gui_mch_enable_scrollbar(&gui.bottom_sbar, @@ -3227,7 +3236,12 @@ gui_init_which_components(oldval) if (gui.which_scrollbars[i]) fix_size = TRUE; } - prev_which_scrollbars[i] = gui.which_scrollbars[i]; +#ifdef FEAT_WINDOWS + curtab->tp_prev_which_scrollbars[i] +#else + prev_which_scrollbars[i] +#endif + = gui.which_scrollbars[i]; } #ifdef FEAT_MENU @@ -3479,7 +3493,7 @@ gui_remove_scrollbars() gui_do_scrollbar(wp, i, FALSE); } } - prev_which_scrollbars[i] = -1; + curtab->tp_prev_which_scrollbars[i] = -1; } } #endif @@ -3673,6 +3687,16 @@ gui_drag_scrollbar(sb, value, still_dragging) /* Value may have been changed for closed fold. */ sb->value = sb->wp->w_topline - 1; # endif + + /* When dragging one scrollbar and there is another one at the other + * side move the thumb of that one too. */ + if (gui.which_scrollbars[SBAR_RIGHT] && gui.which_scrollbars[SBAR_LEFT]) + gui_mch_set_scrollbar_thumb( + &sb->wp->w_scrollbars[ + sb == &sb->wp->w_scrollbars[SBAR_RIGHT] + ? SBAR_LEFT : SBAR_RIGHT], + sb->value, sb->size, sb->max); + #else bytes[0] = CSI; bytes[1] = KS_VER_SCROLLBAR; @@ -596,6 +596,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EXTERNCMD 0x600 /* executing an external command */ #define SHOWMATCH (0x700 + INSERT) /* show matching paren */ #define CONFIRM 0x800 /* ":confirm" prompt */ +#define SELECTMODE 0x1000 /* Select mode, only for mappings */ /* directions */ #define FORWARD 1 @@ -1523,6 +1524,11 @@ int vim_memcmp __ARGS((void *, void *, size_t)); #include "structs.h" /* file that defines many structures */ +/* Values for "do_profiling". */ +#define PROF_NONE 0 /* profiling not started */ +#define PROF_YES 1 /* profiling busy */ +#define PROF_PAUSED 2 /* profiling paused */ + #ifdef FEAT_MOUSE /* Codes for mouse button events in lower three bits: */ @@ -1974,4 +1980,5 @@ typedef int proftime_T; /* dummy for function prototypes */ #define BAD_KEEP -1 /* leave it */ #define BAD_DROP -2 /* erase it */ + #endif /* VIM__H */ diff --git a/src/window.c b/src/window.c index c45022191..c37ec6769 100644 --- a/src/window.c +++ b/src/window.c @@ -3113,6 +3113,12 @@ alloc_tabpage() tp = (tabpage_T *)alloc_clear((unsigned)sizeof(tabpage_T)); if (tp != NULL) { +# ifdef FEAT_GUI + int i; + + for (i = 0; i < 3; i++) + tp->tp_prev_which_scrollbars[i] = -1; +# endif # ifdef FEAT_DIFF tp->tp_diff_invalid = TRUE; # endif @@ -3395,7 +3401,10 @@ enter_tabpage(tp, old_curbuf) /* When 'guioptions' includes 'L' or 'R' may have to remove or add * scrollbars. Have to update them anyway. */ if (gui.in_use && starting == 0) + { + gui_init_which_components(NULL); gui_update_scrollbars(TRUE); + } need_mouse_correct = TRUE; #endif |