|
Karsten Hopp |
7b2e8d |
To: vim-dev@vim.org
|
|
Karsten Hopp |
7b2e8d |
Subject: Patch 7.1.145
|
|
Karsten Hopp |
7b2e8d |
Fcc: outbox
|
|
Karsten Hopp |
7b2e8d |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
7b2e8d |
Mime-Version: 1.0
|
|
Karsten Hopp |
7b2e8d |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
7b2e8d |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
7b2e8d |
------------
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
Patch 7.1.145
|
|
Karsten Hopp |
7b2e8d |
Problem: Insert mode completion: When using the popup menu, after
|
|
Karsten Hopp |
7b2e8d |
completing a word and typing a non-word character Vim is still
|
|
Karsten Hopp |
7b2e8d |
completing the same word, following CTRL-N doesn't work.
|
|
Karsten Hopp |
7b2e8d |
Insert mode Completion: When using CTRL-X O and there is only
|
|
Karsten Hopp |
7b2e8d |
"struct." before the cursor, typing one char to reduce the
|
|
Karsten Hopp |
7b2e8d |
matches, then BS completion stops.
|
|
Karsten Hopp |
7b2e8d |
Solution: When typing a character that is not part of the item being
|
|
Karsten Hopp |
7b2e8d |
completed, stop complete mode. For whole line completion also
|
|
Karsten Hopp |
7b2e8d |
accept a space. For file name completion stop at a path
|
|
Karsten Hopp |
7b2e8d |
separator.
|
|
Karsten Hopp |
7b2e8d |
For omni completion stay in completion mode even if completing
|
|
Karsten Hopp |
7b2e8d |
with empty string.
|
|
Karsten Hopp |
7b2e8d |
Files: src/edit.c
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
*** ../vim-7.1.144/src/edit.c Thu Sep 13 18:25:08 2007
|
|
Karsten Hopp |
7b2e8d |
--- src/edit.c Fri Oct 19 16:04:38 2007
|
|
Karsten Hopp |
7b2e8d |
***************
|
|
Karsten Hopp |
7b2e8d |
*** 129,134 ****
|
|
Karsten Hopp |
7b2e8d |
--- 129,135 ----
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
static void ins_ctrl_x __ARGS((void));
|
|
Karsten Hopp |
7b2e8d |
static int has_compl_option __ARGS((int dict_opt));
|
|
Karsten Hopp |
7b2e8d |
+ static int ins_compl_accept_char __ARGS((int c));
|
|
Karsten Hopp |
7b2e8d |
static int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u **cptext, int cdir, int flags, int adup));
|
|
Karsten Hopp |
7b2e8d |
static int ins_compl_equal __ARGS((compl_T *match, char_u *str, int len));
|
|
Karsten Hopp |
7b2e8d |
static void ins_compl_longest_match __ARGS((compl_T *match));
|
|
Karsten Hopp |
7b2e8d |
***************
|
|
Karsten Hopp |
7b2e8d |
*** 754,761 ****
|
|
Karsten Hopp |
7b2e8d |
continue;
|
|
Karsten Hopp |
7b2e8d |
}
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
! /* A printable, non-white character: Add to "compl_leader". */
|
|
Karsten Hopp |
7b2e8d |
! if (vim_isprintc(c) && !vim_iswhite(c))
|
|
Karsten Hopp |
7b2e8d |
{
|
|
Karsten Hopp |
7b2e8d |
ins_compl_addleader(c);
|
|
Karsten Hopp |
7b2e8d |
continue;
|
|
Karsten Hopp |
7b2e8d |
--- 755,763 ----
|
|
Karsten Hopp |
7b2e8d |
continue;
|
|
Karsten Hopp |
7b2e8d |
}
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
! /* A non-white character that fits in with the current
|
|
Karsten Hopp |
7b2e8d |
! * completion: Add to "compl_leader". */
|
|
Karsten Hopp |
7b2e8d |
! if (ins_compl_accept_char(c))
|
|
Karsten Hopp |
7b2e8d |
{
|
|
Karsten Hopp |
7b2e8d |
ins_compl_addleader(c);
|
|
Karsten Hopp |
7b2e8d |
continue;
|
|
Karsten Hopp |
7b2e8d |
***************
|
|
Karsten Hopp |
7b2e8d |
*** 2053,2058 ****
|
|
Karsten Hopp |
7b2e8d |
--- 2055,2094 ----
|
|
Karsten Hopp |
7b2e8d |
}
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
/*
|
|
Karsten Hopp |
7b2e8d |
+ * Return TRUE when character "c" is part of the item currently being
|
|
Karsten Hopp |
7b2e8d |
+ * completed. Used to decide whether to abandon complete mode when the menu
|
|
Karsten Hopp |
7b2e8d |
+ * is visible.
|
|
Karsten Hopp |
7b2e8d |
+ */
|
|
Karsten Hopp |
7b2e8d |
+ static int
|
|
Karsten Hopp |
7b2e8d |
+ ins_compl_accept_char(c)
|
|
Karsten Hopp |
7b2e8d |
+ int c;
|
|
Karsten Hopp |
7b2e8d |
+ {
|
|
Karsten Hopp |
7b2e8d |
+ if (ctrl_x_mode & CTRL_X_WANT_IDENT)
|
|
Karsten Hopp |
7b2e8d |
+ /* When expanding an identifier only accept identifier chars. */
|
|
Karsten Hopp |
7b2e8d |
+ return vim_isIDc(c);
|
|
Karsten Hopp |
7b2e8d |
+
|
|
Karsten Hopp |
7b2e8d |
+ switch (ctrl_x_mode)
|
|
Karsten Hopp |
7b2e8d |
+ {
|
|
Karsten Hopp |
7b2e8d |
+ case CTRL_X_FILES:
|
|
Karsten Hopp |
7b2e8d |
+ /* When expanding file name only accept file name chars. But not
|
|
Karsten Hopp |
7b2e8d |
+ * path separators, so that "proto/<Tab>" expands files in
|
|
Karsten Hopp |
7b2e8d |
+ * "proto", not "proto/" as a whole */
|
|
Karsten Hopp |
7b2e8d |
+ return vim_isfilec(c) && !vim_ispathsep(c);
|
|
Karsten Hopp |
7b2e8d |
+
|
|
Karsten Hopp |
7b2e8d |
+ case CTRL_X_CMDLINE:
|
|
Karsten Hopp |
7b2e8d |
+ case CTRL_X_OMNI:
|
|
Karsten Hopp |
7b2e8d |
+ /* Command line and Omni completion can work with just about any
|
|
Karsten Hopp |
7b2e8d |
+ * printable character, but do stop at white space. */
|
|
Karsten Hopp |
7b2e8d |
+ return vim_isprintc(c) && !vim_iswhite(c);
|
|
Karsten Hopp |
7b2e8d |
+
|
|
Karsten Hopp |
7b2e8d |
+ case CTRL_X_WHOLE_LINE:
|
|
Karsten Hopp |
7b2e8d |
+ /* For while line completion a space can be part of the line. */
|
|
Karsten Hopp |
7b2e8d |
+ return vim_isprintc(c);
|
|
Karsten Hopp |
7b2e8d |
+ }
|
|
Karsten Hopp |
7b2e8d |
+ return vim_iswordc(c);
|
|
Karsten Hopp |
7b2e8d |
+ }
|
|
Karsten Hopp |
7b2e8d |
+
|
|
Karsten Hopp |
7b2e8d |
+ /*
|
|
Karsten Hopp |
7b2e8d |
* This is like ins_compl_add(), but if 'ic' and 'inf' are set, then the
|
|
Karsten Hopp |
7b2e8d |
* case of the originally typed text is used, and the case of the completed
|
|
Karsten Hopp |
7b2e8d |
* text is inferred, ie this tries to work out what case you probably wanted
|
|
Karsten Hopp |
7b2e8d |
***************
|
|
Karsten Hopp |
7b2e8d |
*** 3128,3135 ****
|
|
Karsten Hopp |
7b2e8d |
p = line + curwin->w_cursor.col;
|
|
Karsten Hopp |
7b2e8d |
mb_ptr_back(line, p);
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
! /* Stop completion when the whole word was deleted. */
|
|
Karsten Hopp |
7b2e8d |
! if ((int)(p - line) - (int)compl_col <= 0)
|
|
Karsten Hopp |
7b2e8d |
return K_BS;
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
/* Deleted more than what was used to find matches or didn't finish
|
|
Karsten Hopp |
7b2e8d |
--- 3164,3174 ----
|
|
Karsten Hopp |
7b2e8d |
p = line + curwin->w_cursor.col;
|
|
Karsten Hopp |
7b2e8d |
mb_ptr_back(line, p);
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
! /* Stop completion when the whole word was deleted. For Omni completion
|
|
Karsten Hopp |
7b2e8d |
! * allow the word to be deleted, we won't match everything. */
|
|
Karsten Hopp |
7b2e8d |
! if ((int)(p - line) - (int)compl_col < 0
|
|
Karsten Hopp |
7b2e8d |
! || ((int)(p - line) - (int)compl_col == 0
|
|
Karsten Hopp |
7b2e8d |
! && (ctrl_x_mode & CTRL_X_OMNI) == 0))
|
|
Karsten Hopp |
7b2e8d |
return K_BS;
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
/* Deleted more than what was used to find matches or didn't finish
|
|
Karsten Hopp |
7b2e8d |
***************
|
|
Karsten Hopp |
7b2e8d |
*** 4591,4604 ****
|
|
Karsten Hopp |
7b2e8d |
curs_col = curwin->w_cursor.col;
|
|
Karsten Hopp |
7b2e8d |
compl_pending = 0;
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
! /* if this same ctrl_x_mode has been interrupted use the text from
|
|
Karsten Hopp |
7b2e8d |
* "compl_startpos" to the cursor as a pattern to add a new word
|
|
Karsten Hopp |
7b2e8d |
* instead of expand the one before the cursor, in word-wise if
|
|
Karsten Hopp |
7b2e8d |
! * "compl_startpos"
|
|
Karsten Hopp |
7b2e8d |
! * is not in the same line as the cursor then fix it (the line has
|
|
Karsten Hopp |
7b2e8d |
! * been split because it was longer than 'tw'). if SOL is set then
|
|
Karsten Hopp |
7b2e8d |
! * skip the previous pattern, a word at the beginning of the line has
|
|
Karsten Hopp |
7b2e8d |
! * been inserted, we'll look for that -- Acevedo. */
|
|
Karsten Hopp |
7b2e8d |
if ((compl_cont_status & CONT_INTRPT) == CONT_INTRPT
|
|
Karsten Hopp |
7b2e8d |
&& compl_cont_mode == ctrl_x_mode)
|
|
Karsten Hopp |
7b2e8d |
{
|
|
Karsten Hopp |
7b2e8d |
--- 4630,4642 ----
|
|
Karsten Hopp |
7b2e8d |
curs_col = curwin->w_cursor.col;
|
|
Karsten Hopp |
7b2e8d |
compl_pending = 0;
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
! /* If this same ctrl_x_mode has been interrupted use the text from
|
|
Karsten Hopp |
7b2e8d |
* "compl_startpos" to the cursor as a pattern to add a new word
|
|
Karsten Hopp |
7b2e8d |
* instead of expand the one before the cursor, in word-wise if
|
|
Karsten Hopp |
7b2e8d |
! * "compl_startpos" is not in the same line as the cursor then fix it
|
|
Karsten Hopp |
7b2e8d |
! * (the line has been split because it was longer than 'tw'). if SOL
|
|
Karsten Hopp |
7b2e8d |
! * is set then skip the previous pattern, a word at the beginning of
|
|
Karsten Hopp |
7b2e8d |
! * the line has been inserted, we'll look for that -- Acevedo. */
|
|
Karsten Hopp |
7b2e8d |
if ((compl_cont_status & CONT_INTRPT) == CONT_INTRPT
|
|
Karsten Hopp |
7b2e8d |
&& compl_cont_mode == ctrl_x_mode)
|
|
Karsten Hopp |
7b2e8d |
{
|
|
Karsten Hopp |
7b2e8d |
*** ../vim-7.1.144/src/version.c Fri Oct 19 18:57:33 2007
|
|
Karsten Hopp |
7b2e8d |
--- src/version.c Fri Oct 19 20:38:21 2007
|
|
Karsten Hopp |
7b2e8d |
***************
|
|
Karsten Hopp |
7b2e8d |
*** 668,669 ****
|
|
Karsten Hopp |
7b2e8d |
--- 668,671 ----
|
|
Karsten Hopp |
7b2e8d |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
7b2e8d |
+ /**/
|
|
Karsten Hopp |
7b2e8d |
+ 145,
|
|
Karsten Hopp |
7b2e8d |
/**/
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
--
|
|
Karsten Hopp |
7b2e8d |
Micro$oft: where do you want to go today?
|
|
Karsten Hopp |
7b2e8d |
Linux: where do you want to go tomorrow?
|
|
Karsten Hopp |
7b2e8d |
FreeBSD: are you guys coming, or what?
|
|
Karsten Hopp |
7b2e8d |
|
|
Karsten Hopp |
7b2e8d |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
7b2e8d |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
7b2e8d |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
7b2e8d |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|