diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-05-03 21:26:49 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-05-03 21:26:49 +0000 |
commit | 9c102387aff079b513533e93bb2a8109ccc1492c (patch) | |
tree | 5dc78df7736efe7105b9e939af9959d9f9f9fd7e /src | |
parent | c05f93ffba24cd678b7f31b40e7b6f64ee12bf74 (diff) |
updated for version 7.0g02
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_docmd.c | 35 | ||||
-rw-r--r-- | src/getchar.c | 17 | ||||
-rw-r--r-- | src/gui.c | 10 | ||||
-rw-r--r-- | src/if_ole.cpp | 2 | ||||
-rw-r--r-- | src/option.c | 2 | ||||
-rw-r--r-- | src/proto/term.pro | 2 | ||||
-rw-r--r-- | src/quickfix.c | 70 | ||||
-rw-r--r-- | src/spell.c | 4 | ||||
-rw-r--r-- | src/term.c | 7 | ||||
-rw-r--r-- | src/version.h | 6 | ||||
-rw-r--r-- | src/window.c | 9 |
11 files changed, 112 insertions, 52 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 5891f83f5d..368d65c77b 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -4999,7 +4999,7 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force) char_u *rep_buf = NULL; garray_T *gap; - replace_termcodes(rep, &rep_buf, FALSE, FALSE); + replace_termcodes(rep, &rep_buf, FALSE, FALSE, FALSE); if (rep_buf == NULL) { /* Can't replace termcodes - try using the string as is */ @@ -9855,29 +9855,12 @@ makeopens(fd, dirnow) return FAIL; /* - * Wipe out an empty unnamed buffer we started in. - */ - if (put_line(fd, "if exists('s:wipebuf')") == FAIL) - return FAIL; - if (put_line(fd, " exe 'bwipe ' . s:wipebuf") == FAIL) - return FAIL; - if (put_line(fd, "endif") == FAIL) - return FAIL; - if (put_line(fd, "unlet! s:wipebuf") == FAIL) - return FAIL; - - /* * Restore window sizes again after jumping around in windows, because * the current window has a minimum size while others may not. */ if (nr > 1 && ses_winsizes(fd, restore_size) == FAIL) return FAIL; - /* Re-apply 'winheight', 'winwidth' and 'shortmess'. */ - if (fprintf(fd, "set winheight=%ld winwidth=%ld shortmess=%s", - p_wh, p_wiw, p_shm) < 0 || put_eol(fd) == FAIL) - return FAIL; - /* Don't continue in another tab page when doing only the current one * or when at the last tab page. */ if (!(ssop_flags & SSOP_TABPAGES) || curtab->tp_next == NULL) @@ -9893,6 +9876,22 @@ makeopens(fd, dirnow) return FAIL; } + /* + * Wipe out an empty unnamed buffer we started in. + */ + if (put_line(fd, "if exists('s:wipebuf')") == FAIL) + return FAIL; + if (put_line(fd, " exe 'bwipe ' . s:wipebuf") == FAIL) + return FAIL; + if (put_line(fd, "endif") == FAIL) + return FAIL; + if (put_line(fd, "unlet! s:wipebuf") == FAIL) + return FAIL; + + /* Re-apply 'winheight', 'winwidth' and 'shortmess'. */ + if (fprintf(fd, "set winheight=%ld winwidth=%ld shortmess=%s", + p_wh, p_wiw, p_shm) < 0 || put_eol(fd) == FAIL) + return FAIL; /* * Lastly, execute the x.vim file if it exists. diff --git a/src/getchar.c b/src/getchar.c index 88e724ff31..7d2cfd786c 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -3034,6 +3034,7 @@ do_map(maptype, arg, mode, abbrev) mapblock_T **map_table; int unique = FALSE; int silent = FALSE; + int special = FALSE; #ifdef FEAT_EVAL int expr = FALSE; #endif @@ -3075,6 +3076,16 @@ do_map(maptype, arg, mode, abbrev) continue; } + /* + * Check for "<special>": accept special keys in <> + */ + if (STRNCMP(keys, "<special>", 9) == 0) + { + keys = skipwhite(keys + 9); + special = TRUE; + continue; + } + #ifdef FEAT_EVAL /* * Check for "<script>": remap script-local mappings only @@ -3147,13 +3158,13 @@ do_map(maptype, arg, mode, abbrev) * replace_termcodes() also removes CTRL-Vs and sometimes backslashes. */ if (haskey) - keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE); + keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, special); if (hasarg) { if (STRICMP(rhs, "<nop>") == 0) /* "<Nop>" means nothing */ rhs = (char_u *)""; else - rhs = replace_termcodes(rhs, &arg_buf, FALSE, TRUE); + rhs = replace_termcodes(rhs, &arg_buf, FALSE, TRUE, special); } #ifdef FEAT_FKMAP @@ -3819,7 +3830,7 @@ map_to_exists(str, modechars, abbr) char_u *buf; int retval; - rhs = replace_termcodes(str, &buf, FALSE, TRUE); + rhs = replace_termcodes(str, &buf, FALSE, TRUE, FALSE); if (vim_strchr(modechars, 'n') != NULL) mode |= NORMAL; @@ -4544,6 +4544,12 @@ gui_mouse_moved(x, y) if (wp == curwin || wp == NULL) return; /* still in the same old window, or none at all */ +#ifdef FEAT_WINDOWS + /* Ignore position in the tab pages line. */ + if (Y_2_ROW(y) < tabline_height()) + return; +#endif + /* * format a mouse click on status line input * ala gui_send_mouse_event(0, x, y, 0, 0); @@ -4597,7 +4603,11 @@ gui_mouse_correct() /* Don't move the mouse when it's left or right of the Vim window */ if (x < 0 || x > Columns * gui.char_width) return; +# ifdef FEAT_WINDOWS + if (Y_2_ROW(y) >= tabline_height()) +# else if (y >= 0) +# endif wp = xy2win(x, y); if (wp != curwin && wp != NULL) /* If in other than current window */ { diff --git a/src/if_ole.cpp b/src/if_ole.cpp index 59c786a423..45ee335a26 100644 --- a/src/if_ole.cpp +++ b/src/if_ole.cpp @@ -314,7 +314,7 @@ CVim::SendKeys(BSTR keys) } /* Translate key codes like <Esc> */ - str = replace_termcodes((char_u *)buffer, &ptr, FALSE, TRUE); + str = replace_termcodes((char_u *)buffer, &ptr, FALSE, TRUE, FALSE); /* If ptr was set, then a new buffer was allocated, * so we can free the old one. diff --git a/src/option.c b/src/option.c index 8d5dcacb66..1234bac90c 100644 --- a/src/option.c +++ b/src/option.c @@ -6420,7 +6420,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, { if (*p_pt) { - (void)replace_termcodes(p_pt, &p, TRUE, TRUE); + (void)replace_termcodes(p_pt, &p, TRUE, TRUE, FALSE); if (p != NULL) { if (new_value_alloced) diff --git a/src/proto/term.pro b/src/proto/term.pro index 7b53749739..9ce594eadf 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -51,7 +51,7 @@ extern char_u *get_termcode __ARGS((int i)); extern void del_termcode __ARGS((char_u *name)); extern void set_mouse_topline __ARGS((win_T *wp)); extern int check_termcode __ARGS((int max_offset, char_u *buf, int buflen)); -extern char_u *replace_termcodes __ARGS((char_u *from, char_u **bufp, int from_part, int do_lt)); +extern char_u *replace_termcodes __ARGS((char_u *from, char_u **bufp, int from_part, int do_lt, int special)); extern int find_term_bykeys __ARGS((char_u *src)); extern void show_termcodes __ARGS((void)); extern int show_one_termcode __ARGS((char_u *name, char_u *code, int printit)); diff --git a/src/quickfix.c b/src/quickfix.c index 4f5fe24802..19e03c4da7 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -118,6 +118,7 @@ static void qf_fmt_text __ARGS((char_u *text, char_u *buf, int bufsize)); static void qf_clean_dir_stack __ARGS((struct dir_stack_T **)); #ifdef FEAT_WINDOWS static int qf_win_pos_update __ARGS((qf_info_T *qi, int old_qf_index)); +static int is_qf_win __ARGS((win_T *win, qf_info_T *qi)); static win_T *qf_find_win __ARGS((qf_info_T *qi)); static buf_T *qf_find_buf __ARGS((qf_info_T *qi)); static void qf_update_buffer __ARGS((qf_info_T *qi)); @@ -2199,6 +2200,7 @@ ex_copen(eap) int height; win_T *win; tabpage_T *prevtab = curtab; + buf_T *qf_buf; if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow) { @@ -2231,6 +2233,8 @@ ex_copen(eap) win_goto(win); else { + qf_buf = qf_find_buf(qi); + /* The current window becomes the previous window afterwards. */ win = curwin; @@ -2256,13 +2260,21 @@ ex_copen(eap) win->w_llist->qf_refcount++; } - (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE); - /* switch off 'swapfile' */ - set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL); - set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix", + if (qf_buf != NULL) + /* Use the existing quickfix buffer */ + (void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE, + ECMD_HIDE + ECMD_OLDBUF); + else + { + /* Create a new quickfix buffer */ + (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE); + /* switch off 'swapfile' */ + set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL); + set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix", OPT_LOCAL); - set_option_value((char_u *)"bh", 0L, (char_u *)"wipe", OPT_LOCAL); - set_option_value((char_u *)"diff", 0L, (char_u *)"", OPT_LOCAL); + set_option_value((char_u *)"bh", 0L, (char_u *)"wipe", OPT_LOCAL); + set_option_value((char_u *)"diff", 0L, (char_u *)"", OPT_LOCAL); + } /* Only set the height when still in the same tab page and there is no * window to the side. */ @@ -2352,7 +2364,31 @@ qf_win_pos_update(qi, old_qf_index) } /* + * Check whether the given window is displaying the specified quickfix/location + * list buffer + */ + static int +is_qf_win(win, qi) + win_T *win; + qf_info_T *qi; +{ + /* + * A window displaying the quickfix buffer will have the w_llist_ref field + * set to NULL. + * A window displaying a location list buffer will have the w_llist_ref + * pointing to the location list. + */ + if (bt_quickfix(win->w_buffer)) + if ((qi == &ql_info && win->w_llist_ref == NULL) + || (qi != &ql_info && win->w_llist_ref == qi)) + return TRUE; + + return FALSE; +} + +/* * Find a window displaying the quickfix/location list 'qi' + * Searches in only the windows opened in the current tab. */ static win_T * qf_find_win(qi) @@ -2360,33 +2396,29 @@ qf_find_win(qi) { win_T *win; - /* - * When searching for the quickfix buffer, find a window - * with w_llist_ref set to NULL. - * When searching for the location list buffer, find a window - * with w_llist_ref pointing to the supplied location list. - */ FOR_ALL_WINDOWS(win) - if (bt_quickfix(win->w_buffer)) - if ((qi == &ql_info && win->w_llist_ref == NULL) - || (qi != &ql_info && win->w_llist_ref == qi)) - break; + if (is_qf_win(win, qi)) + break; return win; } /* - * Find quickfix buffer. + * Find a quickfix buffer. + * Searches in windows opened in all the tabs. */ static buf_T * qf_find_buf(qi) qf_info_T *qi; { + tabpage_T *tp; win_T *win; - win = qf_find_win(qi); + FOR_ALL_TAB_WINDOWS(tp, win) + if (is_qf_win(win, qi)) + return win->w_buffer; - return (win != NULL) ? win->w_buffer: NULL; + return NULL; } /* diff --git a/src/spell.c b/src/spell.c index 5e37500051..757efc6acf 100644 --- a/src/spell.c +++ b/src/spell.c @@ -7031,7 +7031,7 @@ spell_read_wordfile(spin, fname) continue; /* empty or blank line */ rline[l] = NUL; - /* Convert from "=encoding={encoding}" to 'encoding' when needed. */ + /* Convert from "/encoding={encoding}" to 'encoding' when needed. */ vim_free(pc); #ifdef FEAT_MBYTE if (spin->si_conv.vc_type != CONV_NONE) @@ -7069,7 +7069,7 @@ spell_read_wordfile(spin, fname) char_u *enc; /* Setup for conversion to 'encoding'. */ - line += 10; + line += 9; enc = enc_canonize(line); if (enc != NULL && !spin->si_ascii && convert_setup(&spin->si_conv, enc, diff --git a/src/term.c b/src/term.c index 99dc1b0c9a..7597c93bd9 100644 --- a/src/term.c +++ b/src/term.c @@ -4945,12 +4945,13 @@ check_termcode(max_offset, buf, buflen) * nothing). When 'cpoptions' does not contain 'B', a backslash can be used * instead of a CTRL-V. */ - char_u * -replace_termcodes(from, bufp, from_part, do_lt) + char_u * +replace_termcodes(from, bufp, from_part, do_lt, special) char_u *from; char_u **bufp; int from_part; int do_lt; /* also translate <lt> */ + int special; /* always accept <key> notation */ { int i; int slen; @@ -4963,7 +4964,7 @@ replace_termcodes(from, bufp, from_part, do_lt) char_u *result; /* buffer for resulting string */ do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL); - do_special = (vim_strchr(p_cpo, CPO_SPECI) == NULL); + do_special = (vim_strchr(p_cpo, CPO_SPECI) == NULL) || special; do_key_code = (vim_strchr(p_cpo, CPO_KEYCODE) == NULL); /* diff --git a/src/version.h b/src/version.h index d37c326db8..f1c2dc5aa0 100644 --- a/src/version.h +++ b/src/version.h @@ -35,6 +35,6 @@ */ #define VIM_VERSION_NODOT "vim70g" #define VIM_VERSION_SHORT "7.0g" -#define VIM_VERSION_MEDIUM "7.0g-01 BETA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0g01 BETA (2006 May 2)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0g01 BETA (2006 May 2, compiled " +#define VIM_VERSION_MEDIUM "7.0g02 BETA" +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0g02 BETA (2006 May 3)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0g02 BETA (2006 May 3, compiled " diff --git a/src/window.c b/src/window.c index 09c638e0ce..cbcdd4eb91 100644 --- a/src/window.c +++ b/src/window.c @@ -5195,6 +5195,7 @@ win_new_height(wp, height) int sline, line_size; int space; int did_below = FALSE; + int old_height = wp->w_height; #define FRACTION_MULT 16384L /* Don't want a negative height. Happens when splitting a tiny window. @@ -5238,9 +5239,15 @@ win_new_height(wp, height) } else { - space = height; + space = height - 1; + while (lnum > 1) { + /* When using "~" lines stop when at the old topline, don't + * scroll down. */ + if (did_below && height < old_height && lnum <= wp->w_topline) + sline = 0; + space -= line_size; if (space > 0 && sline <= 0 && !did_below) { |