diff options
-rw-r--r-- | runtime/doc/digraph.txt | 9 | ||||
-rw-r--r-- | runtime/doc/options.txt | 16 | ||||
-rw-r--r-- | runtime/doc/term.txt | 6 | ||||
-rw-r--r-- | runtime/filetype.vim | 4 | ||||
-rw-r--r-- | src/edit.c | 32 | ||||
-rw-r--r-- | src/ex_getln.c | 43 | ||||
-rw-r--r-- | src/getchar.c | 6 | ||||
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/keymap.h | 10 | ||||
-rw-r--r-- | src/message.c | 2 | ||||
-rw-r--r-- | src/misc2.c | 50 | ||||
-rw-r--r-- | src/normal.c | 75 | ||||
-rw-r--r-- | src/os_mswin.c | 2 | ||||
-rw-r--r-- | src/os_unix.c | 25 | ||||
-rw-r--r-- | src/quickfix.c | 4 | ||||
-rw-r--r-- | src/regexp.c | 1296 | ||||
-rw-r--r-- | src/term.c | 238 | ||||
-rw-r--r-- | src/testdir/test24.in | bin | 975 -> 1156 bytes | |||
-rw-r--r-- | src/testdir/test24.ok | 5 | ||||
-rw-r--r-- | src/version.h | 4 | ||||
-rw-r--r-- | src/window.c | 4 |
21 files changed, 1199 insertions, 634 deletions
diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt index ed4527175b..201d6a0e5a 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -1,4 +1,4 @@ -*digraph.txt* For Vim version 7.0aa. Last change: 2004 Oct 07 +*digraph.txt* For Vim version 7.0aa. Last change: 2005 Mar 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -161,8 +161,13 @@ These are the RFC1345 digraphs for the one-byte characters. See the output of ":digraphs" for the others. The characters above 255 are only available when Vim was compiled with the |+multi_byte| feature. +EURO + Exception: RFC1345 doesn't specify the euro sign. In Vim the digraph =e was -added for this. +added for this. Note the difference between latin1, where the digraph Cu is +used for the currency sign, and latin9 (iso-8859-15), where the digraph =e is +used for the euro sign, while both of them are the character 164, 0xa4. + *digraph-table* char digraph hex dec official name ~ ^@ NU 0x00 0 NULL (NUL) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index d0b5abf745..2c52c04752 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.0aa. Last change: 2005 Mar 03 +*options.txt* For Vim version 7.0aa. Last change: 2005 Mar 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3972,6 +3972,10 @@ A jump table for the options with a short description can be found at |Q_op|. Number of pixel lines inserted between characters. Useful if the font uses the full character cell height, making lines touch each other. When non-zero there is room for underlining. + With some fonts there can be too much room between lines (to have + space for ascents and descents). Then it makes sense to set + 'linespace' to a negative value. This may cause display problems + though! *'lisp'* *'nolisp'* 'lisp' boolean (default off) @@ -4709,8 +4713,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'printmbcharset' 'pmbcs' string (default "") global {not in Vi} - {only available when compiled with the |+printer| - and |+multi_byte| features} + {only available when compiled with the |+printer|, + |+postscript| and |+multi_byte| features} The CJK character set to be used for CJK output from |:hardcopy|. See |pmbcs-option|. @@ -4718,8 +4722,8 @@ A jump table for the options with a short description can be found at |Q_op|. 'printmbfont' 'pmbfn' string (default "") global {not in Vi} - {only available when compiled with the |+printer| - and |+multi_byte| features} + {only available when compiled with the |+printer|, + |+postscript| and |+multi_byte| features} List of font names to be used for CJK output from |:hardcopy|. See |pmbfn-option|. @@ -6344,7 +6348,7 @@ A jump table for the options with a short description can be found at |Q_op|. xterm2 Works like "xterm", but with the xterm reporting the mouse position while the mouse is dragged. This works much faster and more precise. Your xterm must at - least at patchlevel 88 / XFree 3.3.3 for this to + least at patchlevel 88 / XFree 3.3.3 for this to work. See below for how Vim detects this automatically. *netterm-mouse* diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt index fba493c707..0ac9697c43 100644 --- a/runtime/doc/term.txt +++ b/runtime/doc/term.txt @@ -1,4 +1,4 @@ -*term.txt* For Vim version 7.0aa. Last change: 2005 Mar 04 +*term.txt* For Vim version 7.0aa. Last change: 2005 Mar 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -301,6 +301,10 @@ Note: Use the <> form if possible t_kd <Down> arrow down *t_kd* *'t_kd'* t_kr <Right> arrow right *t_kr* *'t_kr'* t_kl <Left> arrow left *t_kl* *'t_kl'* + <xUp> alternate arrow up *<xUp>* + <xDown> alternate arrow down *<xDown>* + <xRight> alternate arrow right *<xRight>* + <xLeft> alternate arrow left *<xLeft>* <S-Up> shift arrow up <S-Down> shift arrow down t_%i <S-Right> shift arrow right *t_%i* *'t_%i'* diff --git a/runtime/filetype.vim b/runtime/filetype.vim index bbbb6d2c14..768fd5dddf 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2005 Feb 18 +" Last Change: 2005 Mar 06 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -91,7 +91,7 @@ au BufNewFile,BufRead build.xml setf ant au BufNewFile,BufRead proftpd.conf* setf apachestyle " Apache config file -au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,.htaccess,apache.conf* setf apache +au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,.htaccess,apache.conf*,apache2.conf*,/etc/apache2/*.conf* setf apache " XA65 MOS6510 cross assembler au BufNewFile,BufRead *.a65 setf a65 diff --git a/src/edit.c b/src/edit.c index ae00c2aba8..3a3e865969 100644 --- a/src/edit.c +++ b/src/edit.c @@ -710,9 +710,11 @@ edit(cmdchar, startln, count) switch (c) { case K_LEFT: c = K_RIGHT; break; + case K_XLEFT: c = K_XRIGHT; break; case K_S_LEFT: c = K_S_RIGHT; break; case K_C_LEFT: c = K_C_RIGHT; break; case K_RIGHT: c = K_LEFT; break; + case K_XRIGHT: c = K_XLEFT; break; case K_S_RIGHT: c = K_S_LEFT; break; case K_C_RIGHT: c = K_C_LEFT; break; } @@ -1105,7 +1107,11 @@ doESCkey: break; case K_LEFT: - ins_left(); + case K_XLEFT: + if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) + ins_s_left(); + else + ins_left(); break; case K_S_LEFT: @@ -1114,7 +1120,11 @@ doESCkey: break; case K_RIGHT: - ins_right(); + case K_XRIGHT: + if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) + ins_s_right(); + else + ins_right(); break; case K_S_RIGHT: @@ -1123,7 +1133,11 @@ doESCkey: break; case K_UP: - ins_up(FALSE); + case K_XUP: + if (mod_mask & MOD_MASK_SHIFT) + ins_pageup(); + else + ins_up(FALSE); break; case K_S_UP: @@ -1133,7 +1147,11 @@ doESCkey: break; case K_DOWN: - ins_down(FALSE); + case K_XDOWN: + if (mod_mask & MOD_MASK_SHIFT) + ins_pagedown(); + else + ins_down(FALSE); break; case K_S_DOWN: @@ -6193,12 +6211,14 @@ ins_ctrl_g() { /* CTRL-G k and CTRL-G <Up>: cursor up to Insstart.col */ case K_UP: + case K_XUP: case Ctrl_K: case 'k': ins_up(TRUE); break; /* CTRL-G j and CTRL-G <Down>: cursor down to Insstart.col */ case K_DOWN: + case K_XDOWN: case Ctrl_J: case 'j': ins_down(TRUE); break; @@ -6428,6 +6448,10 @@ ins_start_select(c) case K_KPAGEUP: case K_PAGEDOWN: case K_KPAGEDOWN: + case K_XLEFT: + case K_XRIGHT: + case K_XUP: + case K_XDOWN: # ifdef MACOS case K_LEFT: case K_RIGHT: diff --git a/src/ex_getln.c b/src/ex_getln.c index 4c9d17d78f..4c6175b6fb 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -320,9 +320,11 @@ getcmdline(firstc, count, indent) switch (c) { case K_RIGHT: c = K_LEFT; break; + case K_XRIGHT: c = K_XLEFT; break; case K_S_RIGHT: c = K_S_LEFT; break; case K_C_RIGHT: c = K_C_LEFT; break; case K_LEFT: c = K_RIGHT; break; + case K_XLEFT: c = K_XRIGHT; break; case K_S_LEFT: c = K_S_RIGHT; break; case K_C_LEFT: c = K_C_RIGHT; break; } @@ -354,10 +356,11 @@ getcmdline(firstc, count, indent) /* free old command line when finished moving around in the history * list */ if (lookfor != NULL - && c != K_S_DOWN && c != K_S_UP && c != K_DOWN && c != K_UP + && c != K_S_DOWN && c != K_S_UP + && c != K_DOWN && c != K_UP && c != K_XDOWN && c != K_XUP && c != K_PAGEDOWN && c != K_PAGEUP && c != K_KPAGEDOWN && c != K_KPAGEUP - && c != K_LEFT && c != K_RIGHT + && c != K_LEFT && c != K_RIGHT && c != K_XLEFT && c != K_XRIGHT && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) { vim_free(lookfor); @@ -375,9 +378,9 @@ getcmdline(firstc, count, indent) /* Special translations for 'wildmenu' */ if (did_wild_list && p_wmnu) { - if (c == K_LEFT) + if (c == K_LEFT || c == K_XLEFT) c = Ctrl_P; - else if (c == K_RIGHT) + else if (c == K_RIGHT || c == K_XRIGHT) c = Ctrl_N; } /* Hitting CR after "emenu Name.": complete submenu */ @@ -398,7 +401,8 @@ getcmdline(firstc, count, indent) (void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE); did_wild_list = FALSE; #ifdef FEAT_WILDMENU - if (!p_wmnu || (c != K_UP && c != K_DOWN)) + if (!p_wmnu || (c != K_UP && c != K_DOWN + && c != K_XUP && c != K_XDOWN)) #endif xpc.xp_context = EXPAND_NOTHING; wim_index = 0; @@ -443,9 +447,10 @@ getcmdline(firstc, count, indent) if (xpc.xp_context == EXPAND_MENUNAMES && p_wmnu) { /* Hitting <Down> after "emenu Name.": complete submenu */ - if (ccline.cmdbuff[ccline.cmdpos - 1] == '.' && c == K_DOWN) + if (ccline.cmdbuff[ccline.cmdpos - 1] == '.' + && (c == K_DOWN || c == K_XDOWN)) c = p_wc; - else if (c == K_UP) + else if (c == K_UP || c == K_XUP) { /* Hitting <Up>: Remove one submenu name in front of the * cursor */ @@ -492,14 +497,15 @@ getcmdline(firstc, count, indent) upseg[4] = NUL; if (ccline.cmdbuff[ccline.cmdpos - 1] == PATHSEP - && c == K_DOWN + && (c == K_DOWN || c == K_XDOWN) && (ccline.cmdbuff[ccline.cmdpos - 2] != '.' || ccline.cmdbuff[ccline.cmdpos - 3] != '.')) { /* go down a directory */ c = p_wc; } - else if (STRNCMP(xpc.xp_pattern, upseg + 1, 3) == 0 && c == K_DOWN) + else if (STRNCMP(xpc.xp_pattern, upseg + 1, 3) == 0 + && (c == K_DOWN || c == K_XDOWN)) { /* If in a direct ancestor, strip off one ../ to go down */ int found = FALSE; @@ -527,7 +533,7 @@ getcmdline(firstc, count, indent) c = p_wc; } } - else if (c == K_UP) + else if (c == K_UP || c == K_XUP) { /* go up a directory */ int found = FALSE; @@ -1096,6 +1102,7 @@ getcmdline(firstc, count, indent) continue; /* don't do incremental search now */ case K_RIGHT: + case K_XRIGHT: case K_S_RIGHT: case K_C_RIGHT: do @@ -1114,7 +1121,8 @@ getcmdline(firstc, count, indent) #endif ++ccline.cmdpos; } - while ((c == K_S_RIGHT || c == K_C_RIGHT) + while ((c == K_S_RIGHT || c == K_C_RIGHT + || (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL))) && ccline.cmdbuff[ccline.cmdpos] != ' '); #ifdef FEAT_MBYTE if (has_mbyte) @@ -1123,6 +1131,7 @@ getcmdline(firstc, count, indent) goto cmdline_not_changed; case K_LEFT: + case K_XLEFT: case K_S_LEFT: case K_C_LEFT: do @@ -1137,7 +1146,8 @@ getcmdline(firstc, count, indent) #endif ccline.cmdspos -= cmdline_charsize(ccline.cmdpos); } - while ((c == K_S_LEFT || c == K_C_LEFT) + while ((c == K_S_LEFT || c == K_C_LEFT + || (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL))) && ccline.cmdbuff[ccline.cmdpos - 1] != ' '); #ifdef FEAT_MBYTE if (has_mbyte) @@ -1320,7 +1330,9 @@ getcmdline(firstc, count, indent) #ifdef FEAT_CMDHIST case K_UP: + case K_XUP: case K_DOWN: + case K_XDOWN: case K_S_UP: case K_S_DOWN: case K_PAGEUP: @@ -1344,8 +1356,8 @@ getcmdline(firstc, count, indent) for (;;) { /* one step backwards */ - if (c == K_UP || c == K_S_UP || c == Ctrl_P || - c == K_PAGEUP || c == K_KPAGEUP) + if (c == K_UP || c == K_XUP || c == K_S_UP || c == Ctrl_P + || c == K_PAGEUP || c == K_KPAGEUP) { if (hiscnt == hislen) /* first time */ hiscnt = hisidx[histype]; @@ -1381,7 +1393,8 @@ getcmdline(firstc, count, indent) hiscnt = i; break; } - if ((c != K_UP && c != K_DOWN) || hiscnt == i + if ((c != K_UP && c != K_DOWN && c != K_XUP && c != K_XDOWN) + || hiscnt == i || STRNCMP(history[histype][hiscnt].hisstr, lookfor, (size_t)j) == 0) break; diff --git a/src/getchar.c b/src/getchar.c index e93ce05290..c06b600768 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -4530,6 +4530,7 @@ check_map(keys, mode, exact) } #endif +#if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) /* * Default mappings for some often used keys. */ @@ -4609,6 +4610,7 @@ static struct initmap {(char_u *)"<Backspace> \"-d", VISUAL}, #endif +#if 0 /* Map extra keys to their normal equivalents. */ {(char_u *)"<xF1> <F1>", NORMAL+VISUAL+OP_PENDING}, {(char_u *)"<xF1> <F1>", INSERT+CMDLINE}, @@ -4630,7 +4632,9 @@ static struct initmap {(char_u *)"<xEND> <END>", INSERT+CMDLINE}, {(char_u *)"<xHOME> <HOME>", NORMAL+VISUAL+OP_PENDING}, {(char_u *)"<xHOME> <HOME>", INSERT+CMDLINE}, +#endif }; +#endif /* * Set up default mappings. @@ -4638,10 +4642,12 @@ static struct initmap void init_mappings() { +#if defined(MSDOS) || defined(MSWIN) || defined(OS2) || defined(MACOS) int i; for (i = 0; i < sizeof(initmappings) / sizeof(struct initmap); ++i) add_map(initmappings[i].arg, initmappings[i].mode); +#endif } /* diff --git a/src/globals.h b/src/globals.h index 445b453fc5..8251f18312 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1412,9 +1412,11 @@ EXTERN char_u e_nbreadonly[] INIT(=N_("E744: NetBeans does not allow changes in #if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) || defined(PROTO) EXTERN char_u e_intern2[] INIT(=N_("E685: Internal error: %s")); #endif +#if 0 #if defined(HAVE_SETJMP_H) || defined(HAVE_TRY_EXCEPT) || defined(__MINGW32__) EXTERN char_u e_complex[] INIT(=N_("E361: Crash intercepted; regexp too complex?")); #endif +#endif EXTERN char_u e_outofstack[] INIT(=N_("E363: pattern caused out-of-stack error")); EXTERN char_u e_emptybuf[] INIT(=N_("E749: empty buffer")); diff --git a/src/keymap.h b/src/keymap.h index 5babdf4af8..e0e46b7732 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -207,6 +207,10 @@ enum key_extra , KE_XF4 , KE_XEND /* extra (vt100) end key for xterm */ , KE_XHOME /* extra (vt100) home key for xterm */ + , KE_XUP /* extra vt100 cursor keys for xterm */ + , KE_XDOWN + , KE_XLEFT + , KE_XRIGHT , KE_LEFTMOUSE_NM /* non-mappable Left mouse button click */ , KE_LEFTRELEASE_NM /* non-mappable left mouse button release */ @@ -270,6 +274,12 @@ enum key_extra #define K_XF3 TERMCAP2KEY(KS_EXTRA, KE_XF3) #define K_XF4 TERMCAP2KEY(KS_EXTRA, KE_XF4) +/* extra set of cursor keys for vt100 compatible xterm */ +#define K_XUP TERMCAP2KEY(KS_EXTRA, KE_XUP) +#define K_XDOWN TERMCAP2KEY(KS_EXTRA, KE_XDOWN) +#define K_XLEFT TERMCAP2KEY(KS_EXTRA, KE_XLEFT) +#define K_XRIGHT TERMCAP2KEY(KS_EXTRA, KE_XRIGHT) + #define K_F1 TERMCAP2KEY('k', '1') /* function keys */ #define K_F2 TERMCAP2KEY('k', '2') #define K_F3 TERMCAP2KEY('k', '3') diff --git a/src/message.c b/src/message.c index f6494847f5..9b0045d14e 100644 --- a/src/message.c +++ b/src/message.c @@ -1953,6 +1953,7 @@ msg_puts_attr_len(str, maxlen, attr) case BS: case 'k': case K_UP: + case K_XUP: if (!more_back_used) { msg_moremsg(TRUE); @@ -1965,6 +1966,7 @@ msg_puts_attr_len(str, maxlen, attr) case NL: case 'j': case K_DOWN: + case K_XDOWN: lines_left = 1; break; case ':': /* start new command line */ diff --git a/src/misc2.c b/src/misc2.c index 9b21168d84..d4d975dda8 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1784,6 +1784,10 @@ static struct key_name_entry {K_DOWN, (char_u *)"Down"}, {K_LEFT, (char_u *)"Left"}, {K_RIGHT, (char_u *)"Right"}, + {K_XUP, (char_u *)"xUp"}, + {K_XDOWN, (char_u *)"xDown"}, + {K_XLEFT, (char_u *)"xLeft"}, + {K_XRIGHT, (char_u *)"xRight"}, {K_F1, (char_u *)"F1"}, {K_F2, (char_u *)"F2"}, @@ -1957,20 +1961,6 @@ name_to_mod_mask(c) return 0; } -#if 0 /* not used */ -/* - * Decide whether the given key code (K_*) is a shifted special - * key (by looking at mod_mask). If it is, then return the appropriate shifted - * key code, otherwise just return the character as is. - */ - int -check_shifted_spec_key(c) - int c; -{ - return simplify_key(c, &mod_mask); -} -#endif - /* * Check if if there is a special key code for "key" that includes the * modifiers specified. @@ -2008,6 +1998,35 @@ simplify_key(key, modifiers) } /* + * Change <xHome> to <Home>, <xUp> to <Up>, etc. + * "kp" must point to an array that holds the two characters that represent a + * special key. + */ + int +handle_x_keys(key) + int key; +{ + switch (key) + { + case K_XUP: return K_UP; + case K_XDOWN: return K_DOWN; + case K_XLEFT: return K_LEFT; + case K_XRIGHT: return K_RIGHT; + case K_XHOME: return K_HOME; + case K_XEND: return K_END; + case K_XF1: return K_F1; + case K_XF2: return K_F2; + case K_XF3: return K_F3; + case K_XF4: return K_F4; + case K_S_XF1: return K_S_F1; + case K_S_XF2: return K_S_F2; + case K_S_XF3: return K_S_F3; + case K_S_XF4: return K_S_F4; + } + return key; +} + +/* * Return a string which contains the name of the given key when the given * modifiers are down. */ @@ -2246,7 +2265,10 @@ find_special_key(srcp, modp, keycode) if (modifiers != 0 && last_dash[2] == '>') key = last_dash[1]; else + { key = get_special_key_code(last_dash + 1); + key = handle_x_keys(key); + } /* * get_special_key_code() may return NUL for invalid diff --git a/src/normal.c b/src/normal.c index 9bf2e66b7c..df914b5f39 100644 --- a/src/normal.c +++ b/src/normal.c @@ -381,13 +381,17 @@ static const struct nv_cmd {K_KINS, nv_edit, 0, 0}, {K_BS, nv_ctrlh, 0, 0}, {K_UP, nv_up, NV_SSS|NV_STS, FALSE}, + {K_XUP, nv_up, NV_SSS|NV_STS, FALSE}, {K_S_UP, nv_page, NV_SS, BACKWARD}, {K_DOWN, nv_down, NV_SSS|NV_STS, FALSE}, + {K_XDOWN, nv_down, NV_SSS|NV_STS, FALSE}, {K_S_DOWN, nv_page, NV_SS, FORWARD}, {K_LEFT, nv_left, NV_SSS|NV_STS|NV_RL, 0}, + {K_XLEFT, nv_left, NV_SSS|NV_STS|NV_RL, 0}, {K_S_LEFT, nv_bck_word, NV_SS|NV_RL, 0}, {K_C_LEFT, nv_bck_word, NV_SSS|NV_RL|NV_STS, 1}, {K_RIGHT, nv_right, NV_SSS|NV_STS|NV_RL, 0}, + {K_XRIGHT, nv_right, NV_SSS|NV_STS|NV_RL, 0}, {K_S_RIGHT, nv_wordcmd, NV_SS|NV_RL, FALSE}, {K_C_RIGHT, nv_wordcmd, NV_SSS|NV_RL|NV_STS, TRUE}, {K_PAGEUP, nv_page, NV_SSS|NV_STS, BACKWARD}, @@ -832,10 +836,12 @@ getcount: { case 'l': ca.cmdchar = 'h'; break; case K_RIGHT: ca.cmdchar = K_LEFT; break; + case K_XRIGHT: ca.cmdchar = K_XLEFT; break; case K_S_RIGHT: ca.cmdchar = K_S_LEFT; break; case K_C_RIGHT: ca.cmdchar = K_C_LEFT; break; case 'h': ca.cmdchar = 'l'; break; case K_LEFT: ca.cmdchar = K_RIGHT; break; + case K_XLEFT: ca.cmdchar = K_XRIGHT; break; case K_S_LEFT: ca.cmdchar = K_S_RIGHT; break; case K_C_LEFT: ca.cmdchar = K_C_RIGHT; break; case '>': ca.cmdchar = '<'; break; @@ -4316,7 +4322,9 @@ nv_zet(cap) else if (nchar == 'l' || nchar == 'h' || nchar == K_LEFT - || nchar == K_RIGHT) + || nchar == K_XLEFT + || nchar == K_RIGHT + || nchar == K_XRIGHT) { cap->count1 = n ? n * cap->count1 : cap->count1; goto dozet; @@ -4423,6 +4431,7 @@ dozet: /* "zh" - scroll screen to the right */ case 'h': case K_LEFT: + case K_XLEFT: if (!curwin->w_p_wrap) { if ((colnr_T)cap->count1 > curwin->w_leftcol) @@ -4440,6 +4449,7 @@ dozet: /* "zl" - scroll screen to the left */ case 'l': case K_RIGHT: + case K_XRIGHT: if (!curwin->w_p_wrap) { /* scroll the window left */ @@ -5294,6 +5304,15 @@ nv_right(cap) # define PAST_LINE 0 #endif + if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) + { + /* <C-Right> and <S-Right> move a word or WORD right */ + if (mod_mask & MOD_MASK_CTRL) + cap->arg = TRUE; + nv_wordcmd(cap); + return; + } + cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; #ifdef FEAT_VISUAL @@ -5323,7 +5342,7 @@ nv_right(cap) && vim_strchr(p_ww, 's') != NULL) || (cap->cmdchar == 'l' && vim_strchr(p_ww, 'l') != NULL) - || (cap->cmdchar == K_RIGHT + || ((cap->cmdchar == K_RIGHT || cap->cmdchar == K_XRIGHT) && vim_strchr(p_ww, '>') != NULL)) && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { @@ -5399,6 +5418,15 @@ nv_left(cap) { long n; + if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) + { + /* <C-Left> and <S-Left> move a word or WORD left */ + if (mod_mask & MOD_MASK_CTRL) + cap->arg = 1; + nv_bck_word(cap); + return; + } + cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; for (n = cap->count1; n > 0; --n) @@ -5414,7 +5442,7 @@ nv_left(cap) && vim_strchr(p_ww, 'b') != NULL) || (cap->cmdchar == 'h' && vim_strchr(p_ww, 'h') != NULL) - || (cap->cmdchar == K_LEFT + || ((cap->cmdchar == K_LEFT || cap->cmdchar == K_XLEFT) && vim_strchr(p_ww, '<') != NULL)) && curwin->w_cursor.lnum > 1) { @@ -5456,11 +5484,20 @@ nv_left(cap) nv_up(cap) cmdarg_T *cap; { - cap->oap->motion_type = MLINE; - if (cursor_up(cap->count1, cap->oap->op_type == OP_NOP) == FAIL) - clearopbeep(cap->oap); - else if (cap->arg) - beginline(BL_WHITE | BL_FIX); + if (mod_mask & MOD_MASK_SHIFT) + { + /* <S-Up> is page up */ + cap->arg = BACKWARD; + nv_page(cap); + } + else + { + cap->oap->motion_type = MLINE; + if (cursor_up(cap->count1, cap->oap->op_type == OP_NOP) == FAIL) + clearopbeep(cap->oap); + else if (cap->arg) + beginline(BL_WHITE | BL_FIX); + } } /* @@ -5471,6 +5508,13 @@ nv_up(cap) nv_down(cap) cmdarg_T *cap; { + if (mod_mask & MOD_MASK_SHIFT) + { + /* <S-Down> is page down */ + cap->arg = FORWARD; + nv_page(cap); + } + else #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) /* In a quickfix window a <CR> jumps to the error under the cursor. */ if (bt_quickfix(curbuf) && cap->cmdchar == CAR) @@ -5553,8 +5597,9 @@ nv_gotofile(cap) nv_end(cap) cmdarg_T *cap; { - if (cap->arg) /* CTRL-END = goto last line */ + if (cap->arg || (mod_mask & MOD_MASK_CTRL)) /* CTRL-END = goto last line */ { + cap->arg = TRUE; nv_goto(cap); cap->count1 = 1; /* to end of current line */ } @@ -7205,6 +7250,7 @@ nv_g_cmd(cap) */ case 'j': case K_DOWN: + case K_XDOWN: /* with 'nowrap' it works just like the normal "j" command; also when * in a closed fold */ if (!curwin->w_p_wrap @@ -7224,6 +7270,7 @@ nv_g_cmd(cap) case 'k': case K_UP: + case K_XUP: /* with 'nowrap' it works just like the normal "k" command; also when * in a closed fold */ if (!curwin->w_p_wrap @@ -7761,8 +7808,14 @@ nv_lineop(cap) nv_home(cap) cmdarg_T *cap; { - cap->count0 = 1; - nv_pipe(cap); + /* CTRL-HOME is like "gg" */ + if (mod_mask & MOD_MASK_CTRL) + nv_goto(cap); + else + { + cap->count0 = 1; + nv_pipe(cap); + } } /* diff --git a/src/os_mswin.c b/src/os_mswin.c index 5e96da8afe..a5e10be498 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -2564,9 +2564,11 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) switch (data->dwData) { case COPYDATA_ENCODING: +# ifdef FEAT_MBYTE /* Remember the encoding that the client uses. */ vim_free(client_enc); client_enc = enc_canonize((char_u *)data->lpData); +# endif return 1; case COPYDATA_KEYS: diff --git a/src/os_unix.c b/src/os_unix.c index c64a39e027..5df0d35f23 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -610,7 +610,13 @@ mch_delay(msec, ignoreinput) WaitForChar(msec); } -#if defined(HAVE_GETRLIMIT) \ +#if 0 /* disabled, no longer needed now that regmatch() is not recursive */ +# if defined(HAVE_GETRLIMIT) +# define HAVE_STACK_LIMIT +# endif +#endif + +#if defined(HAVE_STACK_LIMIT) \ || (!defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGSTACK)) # define HAVE_CHECK_STACK_GROWTH /* @@ -638,7 +644,7 @@ check_stack_growth(p) } #endif -#if defined(HAVE_GETRLIMIT) || defined(PROTO) +#if defined(HAVE_STACK_LIMIT) || defined(PROTO) static char *stack_limit = NULL; #if defined(_THREAD_SAFE) && defined(HAVE_PTHREAD_NP_H) @@ -951,7 +957,7 @@ deathtrap SIGDEFARG(sigarg) set_vim_var_nr(VV_DYING, (long)entered); #endif -#ifdef HAVE_GETRLIMIT +#ifdef HAVE_STACK_LIMIT /* Since we are now using the signal stack, need to reset the stack * limit. Otherwise using a regexp will fail. */ get_stack_limit(); @@ -2683,12 +2689,10 @@ mch_early_init() { #ifdef HAVE_CHECK_STACK_GROWTH int i; -#endif -#ifdef HAVE_CHECK_STACK_GROWTH check_stack_growth((char *)&i); -# ifdef HAVE_GETRLIMIT +# ifdef HAVE_STACK_LIMIT get_stack_limit(); # endif @@ -3092,7 +3096,8 @@ check_mouse_termcode() ) { set_mouse_termcode(KS_MOUSE, (char_u *)(term_is_8bit(T_NAME) - ? IF_EB("\233M", CSI_STR "M") : IF_EB("\033[M", ESC_STR "[M"))); + ? IF_EB("\233M", CSI_STR "M") + : IF_EB("\033[M", ESC_STR "[M"))); if (*p_mouse != NUL) { /* force mouse off and maybe on to send possibly new mouse @@ -3128,7 +3133,7 @@ check_mouse_termcode() # endif # ifdef FEAT_MOUSE_NET - /* There is no conflict, but one may type ESC } from Insert mode. Don't + /* There is no conflict, but one may type "ESC }" from Insert mode. Don't * define it in the GUI or when using an xterm. */ if (!use_xterm_mouse() # ifdef FEAT_GUI @@ -3148,8 +3153,8 @@ check_mouse_termcode() && !gui.in_use # endif ) - set_mouse_termcode(KS_DEC_MOUSE, - (char_u *)IF_EB("\033[", ESC_STR "[")); + set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME) + ? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "["))); else del_mouse_termcode(KS_DEC_MOUSE); # endif diff --git a/src/quickfix.c b/src/quickfix.c index 8d76e28613..d9ce186cf8 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2418,6 +2418,7 @@ ex_vimgrep(eap) else { found_match = FALSE; +#if 0 #ifdef HAVE_SETJMP_H /* * Matching with a regexp may cause a very deep recursive call of @@ -2437,6 +2438,7 @@ ex_vimgrep(eap) goto jumpend; } #endif +#endif /* Try for a match in all lines of the buffer. */ for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum) { @@ -2475,10 +2477,12 @@ ex_vimgrep(eap) if (got_int) break; } +#if 0 #ifdef HAVE_SETJMP_H jumpend: mch_endjmp(); #endif +#endif if (using_dummy) { diff --git a/src/regexp.c b/src/regexp.c index 36f5bb4566..79d3e2a573 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -2962,8 +2962,6 @@ static int need_clear_zsubexpr = FALSE; /* extmatch subexpressions * still need to be cleared */ #endif -static int out_of_stack; /* TRUE when ran out of stack space */ - /* * Structure used to save the current input state, when it needs to be * restored after trying a match. Used by reg_save() and reg_restore(). @@ -3013,7 +3011,7 @@ static void save_se_one __ARGS((save_se_T *savep, char_u **pp)); *(pp) = (savep)->se_u.ptr; } static int re_num_cmp __ARGS((long_u val, char_u *scan)); -static int regmatch __ARGS((char_u *prog, regsave_T *startp)); +static int regmatch __ARGS((char_u *prog)); static int regrepeat __ARGS((char_u *p, long maxcount)); #ifdef DEBUG @@ -3186,41 +3184,20 @@ vim_regexec_multi(rmp, win, buf, lnum, col) return r; } -#if 0 /* this does not appear to work... */ -# ifdef __MINGW32__ -# define MINGW_TRY +#if 0 /* disabled, no longer needed now that regmatch() is not recursive */ +# ifdef HAVE_SETJMP_H +# define USE_SETJMP +# endif +# ifdef HAVE_TRY_EXCEPT +# define USE_TRY_EXCEPT # endif -#endif - -#ifdef MINGW_TRY -/* - * Special assembly code for MingW to simulate __try / __except. - * Does not work with the optimizer! - */ -# include <excpt.h> - -static void *ESP_save; /* used as _ESP below */ -static void *EBP_save; /* used as _EBP below */ - -__attribute__ ((cdecl)) - EXCEPTION_DISPOSITION - _except_regexec_handler( - struct _EXCEPTION_RECORD *ExceptionRecord, - void *EstablisherFrame, - struct _CONTEXT *ContextRecord, - void *DispatcherContext) -{ - __asm__ __volatile__ ( - "jmp regexec_reentry"); - return 0; /* Function does not return */ -} #endif /* * |