diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/edit.c | 27 | ||||
-rw-r--r-- | src/ex_getln.c | 35 | ||||
-rw-r--r-- | src/globals.h | 4 | ||||
-rw-r--r-- | src/keymap.h | 11 | ||||
-rw-r--r-- | src/misc2.c | 6 | ||||
-rw-r--r-- | src/proto/eval.pro | 2 | ||||
-rw-r--r-- | src/quickfix.c | 312 | ||||
-rw-r--r-- | src/screen.c | 8 | ||||
-rw-r--r-- | src/term.c | 6 | ||||
-rw-r--r-- | src/version.h | 4 |
10 files changed, 266 insertions, 149 deletions
diff --git a/src/edit.c b/src/edit.c index 39fc0ee0a..30eece296 100644 --- a/src/edit.c +++ b/src/edit.c @@ -244,7 +244,6 @@ edit(cmdchar, startln, count) int lastc; colnr_T mincol; static linenr_T o_lnum = 0; - static int o_eol = FALSE; int i; int did_backspace = TRUE; /* previous char was backspace */ #ifdef FEAT_CINDENT @@ -426,7 +425,7 @@ edit(cmdchar, startln, count) */ validate_virtcol(); update_curswant(); - if (((o_eol && curwin->w_cursor.lnum == o_lnum) + if (((ins_at_eol && curwin->w_cursor.lnum == o_lnum) || curwin->w_curswant > curwin->w_virtcol) && *(ptr = ml_get_curline() + curwin->w_cursor.col) != NUL) { @@ -441,7 +440,7 @@ edit(cmdchar, startln, count) } #endif } - o_eol = FALSE; + ins_at_eol = FALSE; } else arrow_used = FALSE; @@ -713,11 +712,9 @@ 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; } @@ -816,10 +813,10 @@ edit(cmdchar, startln, count) restart_edit = 'I'; #ifdef FEAT_VIRTUALEDIT if (virtual_active()) - o_eol = FALSE; /* cursor always keeps its column */ + ins_at_eol = FALSE; /* cursor always keeps its column */ else #endif - o_eol = (gchar_cursor() == NUL); + ins_at_eol = (gchar_cursor() == NUL); goto doESCkey; #ifdef FEAT_SNIFF @@ -888,7 +885,7 @@ doESCkey: #endif /* Always update o_lnum, so that a "CTRL-O ." that adds a line * still puts the cursor back after the inserted text. */ - if (o_eol && gchar_cursor() == NUL) + if (ins_at_eol && gchar_cursor() == NUL) o_lnum = curwin->w_cursor.lnum; if (ins_esc(&count, cmdchar)) @@ -1098,7 +1095,6 @@ doESCkey: case K_HOME: case K_KHOME: - case K_XHOME: case K_S_HOME: case K_C_HOME: ins_home(c); @@ -1106,14 +1102,12 @@ doESCkey: case K_END: case K_KEND: - case K_XEND: case K_S_END: case K_C_END: ins_end(c); break; case K_LEFT: - case K_XLEFT: if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) ins_s_left(); else @@ -1126,7 +1120,6 @@ doESCkey: break; case K_RIGHT: - case K_XRIGHT: if (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL)) ins_s_right(); else @@ -1139,7 +1132,6 @@ doESCkey: break; case K_UP: - case K_XUP: if (mod_mask & MOD_MASK_SHIFT) ins_pageup(); else @@ -1153,7 +1145,6 @@ doESCkey: break; case K_DOWN: - case K_XDOWN: if (mod_mask & MOD_MASK_SHIFT) ins_pagedown(); else @@ -6243,14 +6234,12 @@ 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; @@ -6473,17 +6462,11 @@ ins_start_select(c) switch (c) { case K_KHOME: - case K_XHOME: case K_KEND: - case K_XEND: case K_PAGEUP: 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 53bff7588..a71b68ef9 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -326,11 +326,9 @@ 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; } @@ -363,10 +361,10 @@ getcmdline(firstc, count, indent) * list */ if (lookfor != NULL && c != K_S_DOWN && c != K_S_UP - && c != K_DOWN && c != K_UP && c != K_XDOWN && c != K_XUP + && c != K_DOWN && c != K_UP && c != K_PAGEDOWN && c != K_PAGEUP && c != K_KPAGEDOWN && c != K_KPAGEUP - && c != K_LEFT && c != K_RIGHT && c != K_XLEFT && c != K_XRIGHT + && c != K_LEFT && c != K_RIGHT && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) { vim_free(lookfor); @@ -384,9 +382,9 @@ getcmdline(firstc, count, indent) /* Special translations for 'wildmenu' */ if (did_wild_list && p_wmnu) { - if (c == K_LEFT || c == K_XLEFT) + if (c == K_LEFT) c = Ctrl_P; - else if (c == K_RIGHT || c == K_XRIGHT) + else if (c == K_RIGHT) c = Ctrl_N; } /* Hitting CR after "emenu Name.": complete submenu */ @@ -407,8 +405,7 @@ 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 - && c != K_XUP && c != K_XDOWN)) + if (!p_wmnu || (c != K_UP && c != K_DOWN)) #endif xpc.xp_context = EXPAND_NOTHING; wim_index = 0; @@ -455,10 +452,9 @@ 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 || c == K_XDOWN)) + if (ccline.cmdbuff[ccline.cmdpos - 1] == '.' && c == K_DOWN) c = p_wc; - else if (c == K_UP || c == K_XUP) + else if (c == K_UP) { /* Hitting <Up>: Remove one submenu name in front of the * cursor */ @@ -505,15 +501,14 @@ getcmdline(firstc, count, indent) upseg[4] = NUL; if (ccline.cmdbuff[ccline.cmdpos - 1] == PATHSEP - && (c == K_DOWN || c == K_XDOWN) + && c == K_DOWN && (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 || c == K_XDOWN)) + else if (STRNCMP(xpc.xp_pattern, upseg + 1, 3) == 0 && c == K_DOWN) { /* If in a direct ancestor, strip off one ../ to go down */ int found = FALSE; @@ -541,7 +536,7 @@ getcmdline(firstc, count, indent) c = p_wc; } } - else if (c == K_UP || c == K_XUP) + else if (c == K_UP) { /* go up a directory */ int found = FALSE; @@ -1107,7 +1102,6 @@ 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 @@ -1136,7 +1130,6 @@ getcmdline(firstc, count, indent) goto cmdline_not_changed; case K_LEFT: - case K_XLEFT: case K_S_LEFT: case K_C_LEFT: do @@ -1296,7 +1289,6 @@ getcmdline(firstc, count, indent) case Ctrl_B: /* begin of command line */ case K_HOME: case K_KHOME: - case K_XHOME: case K_S_HOME: case K_C_HOME: ccline.cmdpos = 0; @@ -1306,7 +1298,6 @@ getcmdline(firstc, count, indent) case Ctrl_E: /* end of command line */ case K_END: case K_KEND: - case K_XEND: case K_S_END: case K_C_END: ccline.cmdpos = ccline.cmdlen; @@ -1335,9 +1326,7 @@ 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: @@ -1361,7 +1350,7 @@ getcmdline(firstc, count, indent) for (;;) { /* one step backwards */ - if (c == K_UP || c == K_XUP || c == K_S_UP || c == Ctrl_P + if (c == K_UP|| c == K_S_UP || c == Ctrl_P || c == K_PAGEUP || c == K_KPAGEUP) { if (hiscnt == hislen) /* first time */ @@ -1398,7 +1387,7 @@ getcmdline(firstc, count, indent) hiscnt = i; break; } - if ((c != K_UP && c != K_DOWN && c != K_XUP && c != K_XDOWN) + if ((c != K_UP && c != K_DOWN) || hiscnt == i || STRNCMP(history[histype][hiscnt].hisstr, lookfor, (size_t)j) == 0) diff --git a/src/globals.h b/src/globals.h index af4eed0f3..81c1f7ec7 100644 --- a/src/globals.h +++ b/src/globals.h @@ -63,7 +63,7 @@ EXTERN int screen_Columns INIT(= 0); /* actual size of ScreenLines[] */ /* * When vgetc() is called, it sets mod_mask to the set of modifiers that are - * held down based on the KSMOD_* symbols that are read first. + * held down based on the MOD_MASK_* symbols that are read first. */ EXTERN int mod_mask INIT(= 0x0); /* current key modifiers */ @@ -806,6 +806,8 @@ EXTERN int arrow_used; /* Normally FALSE, set to TRUE after * hitting cursor key in insert mode. * Used by vgetorpeek() to decide when * to call u_sync() */ +EXTERN int ins_at_eol INIT(= FALSE); /* put cursor after eol when + restarting edit after CTRL-O */ #ifdef FEAT_INS_EXPAND EXTERN char_u *edit_submode INIT(= NULL); /* msg for CTRL-X submode */ EXTERN char_u *edit_submode_pre INIT(= NULL); /* prepended to edit_submode */ diff --git a/src/keymap.h b/src/keymap.h index 35bc9b315..96e88044f 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -206,7 +206,9 @@ enum key_extra , KE_XF3 , KE_XF4 , KE_XEND /* extra (vt100) end key for xterm */ + , KE_ZEND /* extra (vt100) end key for xterm */ , KE_XHOME /* extra (vt100) home key for xterm */ + , KE_ZHOME /* extra (vt100) home key for xterm */ , KE_XUP /* extra vt100 cursor keys for xterm */ , KE_XDOWN , KE_XLEFT @@ -381,9 +383,11 @@ enum key_extra #define K_HOME TERMCAP2KEY('k', 'h') #define K_KHOME TERMCAP2KEY('K', '1') /* keypad home (upper left) */ #define K_XHOME TERMCAP2KEY(KS_EXTRA, KE_XHOME) +#define K_ZHOME TERMCAP2KEY(KS_EXTRA, KE_ZHOME) #define K_END TERMCAP2KEY('@', '7') #define K_KEND TERMCAP2KEY('K', '4') /* keypad end (lower left) */ #define K_XEND TERMCAP2KEY(KS_EXTRA, KE_XEND) +#define K_ZEND TERMCAP2KEY(KS_EXTRA, KE_ZEND) #define K_PAGEUP TERMCAP2KEY('k', 'P') #define K_PAGEDOWN TERMCAP2KEY('k', 'N') #define K_KPAGEUP TERMCAP2KEY('K', '3') /* keypad pageup (upper R.) */ @@ -407,13 +411,6 @@ enum key_extra #define K_K8 TERMCAP2KEY('K', 'K') /* keypad 8 */ #define K_K9 TERMCAP2KEY('K', 'L') /* keypad 9 */ -/* - * These are used to recognize a keypad key that does have an ASCII equivalent. - * Since the values are negative, it's the other way around. - */ -#define FIRST_KEYPAD K_K9 -#define LAST_KEYPAD K_KPLUS - #define K_MOUSE TERMCAP2KEY(KS_MOUSE, KE_FILLER) #define K_MENU TERMCAP2KEY(KS_MENU, KE_FILLER) #define K_VER_SCROLLBAR TERMCAP2KEY(KS_VER_SCROLLBAR, KE_FILLER) diff --git a/src/misc2.c b/src/misc2.c index ebf3933e8..c8952074c 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1843,9 +1843,11 @@ static struct key_name_entry {K_HOME, (char_u *)"Home"}, {K_KHOME, (char_u *)"kHome"}, {K_XHOME, (char_u *)"xHome"}, + {K_ZHOME, (char_u *)"zHome"}, {K_END, (char_u *)"End"}, {K_KEND, (char_u *)"kEnd"}, {K_XEND, (char_u *)"xEnd"}, + {K_ZEND, (char_u *)"zEnd"}, {K_PAGEUP, (char_u *)"PageUp"}, {K_PAGEDOWN, (char_u *)"PageDown"}, {K_KPAGEUP, (char_u *)"kPageUp"}, @@ -1999,8 +2001,6 @@ 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) @@ -2013,7 +2013,9 @@ handle_x_keys(key) case K_XLEFT: return K_LEFT; case K_XRIGHT: return K_RIGHT; case K_XHOME: return K_HOME; + case K_ZHOME: return K_HOME; case K_XEND: return K_END; + case K_ZEND: return K_END; case K_XF1: return K_F1; case K_XF2: return K_F2; case K_XF3: return K_F3; diff --git a/src/proto/eval.pro b/src/proto/eval.pro index 023f422c1..13bd82af8 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -39,6 +39,8 @@ char_u *get_user_var_name __ARGS((expand_T *xp, int idx)); int list_append_dict __ARGS((list_T *list, dict_T *dict)); dict_T *dict_alloc __ARGS((void)); int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str)); +char_u *get_dict_string __ARGS((dict_T *d, char_u *key)); +long get_dict_number __ARGS((dict_T *d, char_u *key)); char_u *get_function_name __ARGS((expand_T *xp, int idx)); char_u *get_expr_name __ARGS((expand_T *xp, int idx)); void set_vim_var_nr __ARGS((int idx, long val)); diff --git a/src/quickfix.c b/src/quickfix.c index c34f47f79..a4c016e09 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -24,22 +24,24 @@ struct dir_stack_T static struct dir_stack_T *dir_stack = NULL; /* - * for each error the next struct is allocated and linked in a list + * For each error the next struct is allocated and linked in a list. */ -struct qf_line +typedef struct qfline_S qfline_T; +struct qfline_S { - struct qf_line *qf_next; /* pointer to next error in the list */ - struct qf_line *qf_prev; /* pointer to previous error in the list */ - linenr_T qf_lnum; /* line number where the error occurred */ - int qf_fnum; /* file number for the line */ - int qf_col; /* column where the error occurred */ - int qf_nr; /* error number */ - char_u *qf_text; /* description of the error */ - char_u qf_viscol; /* set to TRUE if qf_col is screen column */ - char_u qf_cleared;/* set to TRUE if line has been deleted */ - char_u qf_type; /* type of the error (mostly 'E'); 1 for + qfline_T *qf_next; /* pointer to next error in the list */ + qfline_T *qf_prev; /* pointer to previous error in the list */ + linenr_T qf_lnum; /* line number where the error occurred */ + int qf_fnum; /* file number for the line */ + int qf_col; /* column where the error occurred */ + int qf_nr; /* error number */ + char_u *qf_pattern; /* search pattern for the error */ + char_u *qf_text; /* description of the error */ + char_u qf_viscol; /* set to TRUE if qf_col is screen column */ + char_u qf_cleared; /* set to TRUE if line has been deleted */ + char_u qf_type; /* type of the error (mostly 'E'); 1 for :helpgrep */ - char_u qf_valid; /* valid error message detected */ + char_u qf_valid; /* valid error message detected */ }; /* @@ -49,17 +51,17 @@ struct qf_line struct qf_list { - struct qf_line *qf_start; /* pointer to the first error */ - struct qf_line *qf_ptr; /* pointer to the current error */ - int qf_count; /* number of errors (0 means no error list) */ - int qf_index; /* current index in the error list */ - int qf_nonevalid; /* TRUE if not a single valid entry found */ + qfline_T *qf_start; /* pointer to the first error */ + qfline_T *qf_ptr; /* pointer to the current error */ + int qf_count; /* number of errors (0 means no error list) */ + int qf_index; /* current index in the error list */ + int qf_nonevalid; /* TRUE if not a single valid entry found */ } qf_lists[LISTCOUNT]; static int qf_curlist = 0; /* current error list */ static int qf_listcount = 0; /* current number of lists */ -#define FMT_PATTERNS 9 /* maximum number of % recognized */ +#define FMT_PATTERNS 10 /* maximum number of % recognized */ /* * Structure used to hold the info of one part of 'errorformat' @@ -88,7 +90,7 @@ struct eformat static int qf_init_ext __ARGS((char_u *efile, buf_T *buf, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast)); static void qf_new_list __ARGS((void)); -static int qf_add_entry __ARGS((struct qf_line **prevp, char_u *dir, char_u *fname, char_u *mesg, long lnum, int col, int vis_col, int nr, int type, int valid)); +static int qf_add_entry __ARGS((qfline_T **prevp, char_u *dir, char_u *fname, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid)); static void qf_msg __ARGS((void)); static void qf_free __ARGS((int idx)); static char_u *qf_types __ARGS((int, int)); @@ -145,6 +147,7 @@ qf_init_ext(efile, buf, errorformat, newlist, lnumfirst, lnumlast) { char_u *namebuf; char_u *errmsg; + char_u *pattern; char_u *fmtstr = NULL; int col = 0; char_u use_viscol = FALSE; @@ -154,7 +157,7 @@ qf_init_ext(efile, buf, errorformat, newlist, lnumfirst, lnumlast) long lnum = 0L; int enr = 0; FILE *fd = NULL; - struct qf_line *qfprev = NULL; /* init to make SASC shut up */ + qfline_T *qfprev = NULL; /* init to make SASC shut up */ char_u *efmp; struct eformat *fmt_first = NULL; struct eformat *fmt_last = NULL; @@ -189,12 +192,14 @@ qf_init_ext(efile, buf, errorformat, newlist, lnumfirst, lnumlast) {'m', ".\\+"}, {'r', ".*"}, {'p', "[- .]*"}, - {'v', "\\d\\+"} + {'v', "\\d\\+"}, + {'s', ".\\+"} }; namebuf = alloc(CMDBUFFSIZE + 1); errmsg = alloc(CMDBUFFSIZE + 1); - if (namebuf == NULL || errmsg == NULL) + pattern = alloc(CMDBUFFSIZE + 1); + if (namebuf == NULL || errmsg == NULL || pattern == NULL) goto qf_init_end; if (efile != NULL && (fd = mch_fopen((char *)efile, "r")) == NULL) @@ -463,6 +468,7 @@ restofline: if (multiscan && vim_strchr((char_u *)"OPQ", idx) == NULL) continue; namebuf[0] = NUL; + pattern[0] = NUL; if (!multiscan) errmsg[0] = NUL; lnum = 0; @@ -522,6 +528,17 @@ restofline: col = (int)atol((char *)regmatch.startp[i]); use_viscol = TRUE; } + if ((i = (int)fmt_ptr->addr[9]) > 0) /* %s */ + { + len = (int)(regmatch.endp[i] - regmatch.startp[i]); + if (len > CMDBUFFSIZE - 5) + len = CMDBUFFSIZE - 5; + STRCPY(pattern, "^\\V"); + STRNCAT(pattern, regmatch.startp[i], len); + pattern[len + 3] = '\\'; + pattern[len + 4] = '$'; + pattern[len + 5] = NUL; + } break; } } @@ -624,6 +641,7 @@ restofline: lnum, col, use_viscol, + pattern, enr, type, valid) == FAIL) @@ -667,6 +685,7 @@ qf_init_ok: qf_init_end: vim_free(namebuf); vim_free(errmsg); + vim_free(pattern); vim_free(fmtstr); #ifdef FEAT_WINDOWS @@ -714,22 +733,23 @@ qf_new_list() * Returns OK or FAIL. */ static int -qf_add_entry(prevp, dir, fname, mesg, lnum, col, vis_col, nr, type, valid) - struct qf_line **prevp; /* pointer to previously added entry or NULL */ +qf_add_entry(prevp, dir, fname, mesg, lnum, col, vis_col, pattern, nr, type, + valid) + qfline_T **prevp; /* pointer to previously added entry or NULL */ char_u *dir; /* optional directory name */ char_u *fname; /* file name or NULL */ char_u *mesg; /* message */ long lnum; /* line number */ int col; /* column */ int vis_col; /* using visual column */ + char_u *pattern; /* search pattern */ int nr; /* error number */ int type; /* type character */ int valid; /* valid entry */ { - struct qf_line *qfp; + qfline_T *qfp; - if ((qfp = (struct qf_line *)alloc((unsigned)sizeof(struct qf_line))) - == NULL) + if ((qfp = (qfline_T *)alloc((unsigned)sizeof(qfline_T))) == NULL) return FAIL; qfp->qf_fnum = qf_get_fnum(dir, fname); if ((qfp->qf_text = vim_strsave(mesg)) == NULL) @@ -740,6 +760,14 @@ qf_add_entry(prevp, dir, fname, mesg, lnum, col, vis_col, nr, type, valid) qfp->qf_lnum = lnum; qfp->qf_col = col; qfp->qf_viscol = vis_col; + if (pattern == NULL || *pattern == NUL) + qfp->qf_pattern = NULL; + else if ((qfp->qf_pattern = vim_strsave(pattern)) == NULL) + { + vim_free(qfp->qf_text); + vim_free(qfp); + return FAIL; + } qfp->qf_nr = nr; if (type != 1 && !vim_isprintc(type)) /* only printable chars allowed */ type = 0; @@ -1018,8 +1046,8 @@ qf_jump(dir, errornr, forceit) int errornr; int forceit; { - struct qf_line *qf_ptr; - struct qf_line *old_qf_ptr; + qfline_T *qf_ptr; + qfline_T *old_qf_ptr; int qf_index; int old_qf_fnum; int old_qf_index; @@ -1272,46 +1300,59 @@ qf_jump(dir, errornr, forceit) if (curbuf == old_curbuf) setpcmark(); - /* - * Go to line with error, unless qf_lnum is 0. - */ - i = qf_ptr->qf_lnum; - if (i > 0) + if (qf_ptr->qf_pattern == NULL) { - if (i > curbuf->b_ml.ml_line_count) - i = curbuf->b_ml.ml_line_count; - curwin->w_cursor.lnum = i; - } - if (qf_ptr->qf_col > 0) - { - curwin->w_cursor.col = qf_ptr->qf_col - 1; - if (qf_ptr->qf_viscol == TRUE) + /* + * Go to line with error, unless qf_lnum is 0. + */ + i = qf_ptr->qf_lnum; + if (i > 0) { - /* - * Check each character from the beginning of the error - * line up to the error column. For each tab character - * found, reduce the error column value by the length of - * a tab character. - */ - line = ml_get_curline(); - screen_col = 0; - for (char_col = 0; char_col < curwin->w_cursor.col; ++char_col) + if (i > curbuf->b_ml.ml_line_count) + i = curbuf->b_ml.ml_line_count; + curwin->w_cursor.lnum = i; + } + if (qf_ptr->qf_col > 0) + { + curwin->w_cursor.col = qf_ptr->qf_col - 1; + if (qf_ptr->qf_viscol == TRUE) { - if (*line == NUL) - break; - if (*line++ == '\t') + /* + * Check each character from the beginning of the error + * line up to the error column. For each tab character + * found, reduce the error column value by the length of + * a tab character. + */ + line = ml_get_curline(); + screen_col = 0; + for (char_col = 0; char_col < curwin->w_cursor.col; ++char_col) { - curwin->w_cursor.col -= 7 - (screen_col % 8); - screen_col += 8 - (screen_col % 8); + if (*line == NUL) + break; + if (*line++ == '\t') + { + curwin->w_cursor.col -= 7 - (screen_col % 8); + screen_col += 8 - (screen_col % 8); + } + else + ++screen_col; } - else - ++screen_col; } + check_cursor(); } - check_cursor(); + else + beginline(BL_WHITE | BL_FIX); } else - beginline(BL_WHITE | BL_FIX); + { + pos_T save_cursor; + + /* Move the cursor to the first line in the buffer */ + save_cursor = curwin->w_cursor; + curwin->w_cursor.lnum = 0; + if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1, SEARCH_KEEP)) + curwin->w_cursor = save_cursor; + } #ifdef FEAT_FOLDING if ((fdo_flags & FDO_QUICKFIX) && old_KeyTyped) @@ -1383,16 +1424,16 @@ theend: qf_list(eap) exarg_T *eap; { - buf_T *buf; - char_u *fname; - struct qf_line *qfp; - int i; - int idx1 = 1; - int idx2 = -1; - int need_return = TRUE; - int last_printed = 1; - char_u *arg = eap->arg; - int all = eap->forceit; /* if not :cl!, only show + buf_T *buf; + char_u *fname; + qfline_T *qfp; + int i; + int idx1 = 1; + int idx2 = -1; + int need_return = TRUE; + int last_printed = 1; + char_u *arg = eap->arg; + int all = eap->forceit; /* if not :cl!, only show recognised errors */ if (qf_curlist >= qf_listcount || qf_lists[qf_curlist].qf_count == 0) @@ -1447,9 +1488,17 @@ qf_list(eap) else sprintf((char *)IObuff, ":%ld col %d", qfp->qf_lnum, qfp->qf_col); - sprintf((char *)IObuff + STRLEN(IObuff), "%s: ", + sprintf((char *)IObuff + STRLEN(IObuff), "%s:", (char *)qf_types(qfp->qf_type, qfp->qf_nr)); msg_puts_attr(IObuff, hl_attr(HLF_N)); + if (qfp->qf_pattern != NULL) + { + qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); + STRCAT(IObuff, ":"); + msg_puts(IObuff); + } + msg_puts((char_u *)" "); + /* Remove newlines and leading whitespace from the text. * For an unrecognized line keep the indent, the compiler may * mark a word with ^^^^. */ @@ -1571,12 +1620,13 @@ qf_msg() qf_free(idx) int idx; { - struct qf_line *qfp; + qfline_T *qfp; while (qf_lists[idx].qf_count) { qfp = qf_lists[idx].qf_start->qf_next; vim_free(qf_lists[idx].qf_start->qf_text); + vim_free(qf_lists[idx].qf_start->qf_pattern); vim_free(qf_lists[idx].qf_start); qf_lists[idx].qf_start = qfp; --qf_lists[idx].qf_count; @@ -1593,9 +1643,9 @@ qf_mark_adjust(line1, line2, amount, amount_after) long amount; long amount_after; { - int i; - struct qf_line *qfp; - int idx; + int i; + qfline_T *qfp; + int idx; for (idx = 0; idx < qf_listcount; ++idx) if (qf_lists[idx].qf_count) @@ -1912,11 +1962,11 @@ qf_update_buffer() static void qf_fill_buffer() { - linenr_T lnum; - struct qf_line *qfp; - buf_T *errbuf; - int len; - int old_KeyTyped = KeyTyped; + linenr_T lnum; + qfline_T *qfp; + buf_T *errbuf; + int len; + int old_KeyTyped = KeyTyped; /* delete all existing lines */ while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0) @@ -1958,6 +2008,11 @@ qf_fill_buffer() (char *)qf_types(qfp->qf_type, qfp->qf_nr)); len += (int)STRLEN(IObuff + len); } + else if (qfp->qf_pattern != NULL) + { + qf_fmt_text(qfp->qf_pattern, IObuff + len, IOSIZE - len); + len += (int)STRLEN(IObuff + len); + } IObuff[len++] = '|'; IObuff[len++] = ' '; @@ -2285,7 +2340,7 @@ ex_vimgrep(eap) char_u *p; int i; int fi; - struct qf_line *prevp = NULL; + qfline_T *prevp = NULL; long lnum; garray_T ga; buf_T *buf; @@ -2434,6 +2489,7 @@ ex_vimgrep(eap) regmatch.startpos[0].lnum + lnum, regmatch.startpos[0].col + 1, FALSE, /* vis_col */ + NULL, /* search pattern */ 0, /* nr */ 0, /* type */ TRUE /* valid */ @@ -2696,10 +2752,10 @@ unload_dummy_buffer(buf) get_errorlist(list) list_T *list; { - dict_T *dict; - char_u buf[2]; - struct qf_line *qfp; - int i; + dict_T *dict; + char_u buf[2]; + qfline_T *qfp; + int i; if (qf_curlist >= qf_listcount || qf_lists[qf_curlist].qf_count == 0) { @@ -2722,6 +2778,7 @@ get_errorlist(list) || dict_add_nr_str(dict, "col", (long)qfp->qf_col, NULL) == FAIL || dict_add_nr_str(dict, "vcol", (long)qfp->qf_viscol, NULL) == FAIL || dict_add_nr_str(dict, "nr", (long)qfp->qf_nr, NULL) == FAIL + || dict_add_nr_str(dict, "pattern", 0L, qfp->qf_pattern) == FAIL || dict_add_nr_str(dict, "text", 0L, qfp->qf_text) == FAIL || dict_add_nr_str(dict, "type", 0L, buf) == FAIL || dict_add_nr_str(dict, "valid", (long)qfp->qf_valid, NULL) == FAIL) @@ -2731,6 +2788,86 @@ get_errorlist(list) } return OK; } + +/* + * Populate the quickfix list with the items supplied in the list + * of dictionaries. + */ + int +set_errorlist(list) + list_T *list; +{ + listitem_T *li; + dict_T *d; + char_u *filename, *pattern, *text, *type; + long lnum; + int col, nr; + int vcol; + qfline_T *prevp = NULL; + int valid, status; + int retval = OK; + + /* make place for a new list */ + qf_new_list(); + + for (li = list->lv_first; li != NULL; li = li->li_next) + { + if (li->li_tv.v_type != VAR_DICT) + continue; /* Skip non-dict items */ + + d = li->li_tv.vval.v_dict; + if (d == NULL) + continue; + + filename = get_dict_string(d, (char_u *)"filename"); + lnum = get_dict_number(d, (char_u *)"lnum"); + col = get_dict_number(d, (char_u *)"col"); + vcol = get_dict_number(d, (char_u *)"vcol"); + nr = get_dict_number(d, (char_u *)"nr"); + type = get_dict_string(d, (char_u *)"type"); + pattern = get_dict_string(d, (char_u *)"pattern"); + text = get_dict_string(d, (char_u *)"text"); + if (text == NULL) + text = vim_strsave((char_u *)""); + + valid = TRUE; + if (filename == NULL || (lnum == 0 && pattern == NULL)) + valid = FALSE; + + status = qf_add_entry(&prevp, + NULL, /* dir */ + filename, + text, + lnum, + col, + vcol, /* vis_col */ + pattern, /* search pattern */ + nr, + type == NULL ? NUL : *type, + valid); + + vim_free(filename); + vim_free(pattern); + vim_free(text); + vim_free(type); + + if (status == FAIL) + { + retval = FAIL; + break; + } + } + + qf_lists[qf_curlist].qf_nonevalid = FALSE; + qf_lists[qf_curlist].qf_ptr = qf_lists[qf_curlist].qf_start; + qf_lists[qf_curlist].qf_index = 1; + +#ifdef FEAT_WINDOWS + qf_update_buffer(); +#endif + + return retval; +} #endif /* @@ -2779,7 +2916,7 @@ ex_helpgrep(eap) char_u **fnames; FILE *fd; int fi; - struct qf_line *prevp = NULL; + qfline_T *prevp = NULL; long lnum; #ifdef FEAT_MULTI_LANG char_u *lang; @@ -2848,6 +2985,7 @@ ex_helpgrep(eap) (int)(regmatch.startp[0] - IObuff) + 1, /* col */ FALSE, /* vis_col */ + NULL, /* search pattern */ 0, /* nr */ 1, /* type */ TRUE /* valid */ diff --git a/src/screen.c b/src/screen.c index 28565fa42..70c7ff189 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2337,7 +2337,7 @@ fold_line(wp, fold_count, foldinfo, lnum, row) else len = W_WIDTH(wp) - txtcol; RL_MEMSET(wp->w_old_cursor_fcol + txtcol, hl_attr(HLF_V), - len - wp->w_old_cursor_fcol); + len - (int)wp->w_old_cursor_fcol); } } else @@ -3591,6 +3591,9 @@ win_line(wp, lnum, startrow, endrow) * @Spell cluster. */ if (has_spell && v >= word_end) { + spell_attr = 0; + if (area_attr == 0 && search_attr == 0) + char_attr = syntax_attr; if (!has_syntax || can_spell) { char_u *prev_ptr = ptr - ( @@ -3599,7 +3602,6 @@ win_line(wp, lnum, startrow, endrow) # endif 1); - spell_attr = 0; iswordc = spell_iswordc(prev_ptr); if (iswordc && !prev_iswordc) { @@ -3620,8 +3622,6 @@ win_line(wp, lnum, startrow, endrow) } prev_iswordc = iswordc; } - else - spell_attr = 0; } if (spell_attr != 0) char_attr = hl_combine_attr(char_attr, spell_attr); diff --git a/src/term.c b/src/term.c index c4f2d9f8e..20203b5cf 100644 --- a/src/term.c +++ b/src/term.c @@ -1030,13 +1030,15 @@ struct builtin_term builtin_termcaps[] = {K_HOME, IF_EB("\033[1;*H", ESC_STR "[1;*H")}, /* {K_S_HOME, IF_EB("\033O2H", ESC_STR "O2H")}, */ /* {K_C_HOME, IF_EB("\033O5H", ESC_STR "O5H")}, */ - {K_KHOME, IF_EB("\033[7;*~", ESC_STR "[7;*~")}, + {K_KHOME, IF_EB("\033[1;*~", ESC_STR "[1;*~")}, {K_XHOME, IF_EB("\033O*H", ESC_STR "O*H")}, /* other Home */ + {K_ZHOME, IF_EB("\033[7;*~", ESC_STR "[7;*~")}, /* other Home */ {K_END, IF_EB("\033[1;*F", ESC_STR "[1;*F")}, /* {K_S_END, IF_EB("\033O2F", ESC_STR "O2F")}, */ /* {K_C_END, IF_EB("\033O5F", ESC_STR "O5F")}, */ {K_KEND, IF_EB("\033[4;*~", ESC_STR "[4;*~")}, {K_XEND, IF_EB("\033O*F", ESC_STR "O*F")}, /* other End */ + {K_ZEND, IF_EB("\033[8;*~", ESC_STR "[8;*~")}, {K_PAGEUP, IF_EB("\033[5;*~", ESC_STR "[5;*~")}, {K_PAGEDOWN, IF_EB("\033[6;*~", ESC_STR "[6;*~")}, {K_KPLUS, IF_EB("\033O*k", ESC_STR "O*k")}, /* keypad plus */ @@ -1340,11 +1342,13 @@ struct builtin_term builtin_termcaps[] = {K_C_HOME, "[C-HOME]"}, {K_KHOME, "[KHOME]"}, {K_XHOME, "[XHOME]"}, + {K_ZHOME, "[ZHOME]"}, {K_END, "[END]"}, {K_S_END, "[C-END]"}, {K_C_END, "[C-END]"}, {K_KEND, "[KEND]"}, {K_XEND, "[XEND]"}, + {K_ZEND, "[ZEND]"}, {K_PAGEUP, "[PAGEUP]"}, {K_PAGEDOWN, "[PAGEDOWN]"}, {K_KPAGEUP, "[KPAGEUP]"}, diff --git a/src/version.h b/src/version.h index 2f2da8bab..8ecdf38eb 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 22)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 22, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 25)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 25, compiled " |