]> git.pld-linux.org Git - packages/vim.git/blob - 7.0.013
- updated to 1.15
[packages/vim.git] / 7.0.013
1 To: vim-dev@vim.org
2 Subject: Patch 7.0.013
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.0.013
11 Problem:    Insert mode completion: using CTRL-L to add an extra character
12             also deselects the current match, making it impossible to use
13             CTRL-L a second time.
14 Solution:   Keep the current match.  Also make CTRL-L work at the original
15             text, using the first displayed match.
16 Files:      src/edit.c
17
18
19 *** ../vim-7.0.012/src/edit.c   Wed May 10 15:22:49 2006
20 --- src/edit.c  Thu May 11 10:38:54 2006
21 ***************
22 *** 751,757 ****
23                     continue;
24                 }
25   
26 !               /* Pressing CTRL-Y selects the current match.  Shen
27                  * compl_enter_selects is set the Enter key does the same. */
28                 if (c == Ctrl_Y || (compl_enter_selects
29                                    && (c == CAR || c == K_KENTER || c == NL)))
30 --- 751,757 ----
31                     continue;
32                 }
33   
34 !               /* Pressing CTRL-Y selects the current match.  When
35                  * compl_enter_selects is set the Enter key does the same. */
36                 if (c == Ctrl_Y || (compl_enter_selects
37                                    && (c == CAR || c == K_KENTER || c == NL)))
38 ***************
39 *** 3046,3052 ****
40       ins_compl_delete();
41       ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
42       compl_used_match = FALSE;
43 -     compl_enter_selects = FALSE;
44   
45       if (compl_started)
46         ins_compl_set_original_text(compl_leader);
47 --- 3046,3051 ----
48 ***************
49 *** 3076,3081 ****
50 --- 3075,3081 ----
51         compl_restarting = FALSE;
52       }
53   
54 + #if 0   /* disabled, made CTRL-L, BS and typing char jump to original text. */
55       if (!compl_used_match)
56       {
57         /* Go to the original text, since none of the matches is inserted. */
58 ***************
59 *** 3087,3092 ****
60 --- 3087,3094 ----
61         compl_curr_match = compl_shown_match;
62         compl_shows_dir = compl_direction;
63       }
64 + #endif
65 +     compl_enter_selects = !compl_used_match;
66   
67       /* Show the popup menu with a different set of matches. */
68       ins_compl_show_pum();
69 ***************
70 *** 3175,3184 ****
71       char_u    *p;
72       int               len = curwin->w_cursor.col - compl_col;
73       int               c;
74   
75       p = compl_shown_match->cp_str;
76       if ((int)STRLEN(p) <= len)   /* the match is too short */
77 !       return;
78       p += len;
79   #ifdef FEAT_MBYTE
80       c = mb_ptr2char(p);
81 --- 3177,3208 ----
82       char_u    *p;
83       int               len = curwin->w_cursor.col - compl_col;
84       int               c;
85 +     compl_T   *cp;
86   
87       p = compl_shown_match->cp_str;
88       if ((int)STRLEN(p) <= len)   /* the match is too short */
89 !     {
90 !       /* When still at the original match use the first entry that matches
91 !        * the leader. */
92 !       if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
93 !       {
94 !           p = NULL;
95 !           for (cp = compl_shown_match->cp_next; cp != NULL
96 !                                && cp != compl_first_match; cp = cp->cp_next)
97 !           {
98 !               if (ins_compl_equal(cp, compl_leader,
99 !                                                  (int)STRLEN(compl_leader)))
100 !               {
101 !                   p = cp->cp_str;
102 !                   break;
103 !               }
104 !           }
105 !           if (p == NULL || (int)STRLEN(p) <= len)
106 !               return;
107 !       }
108 !       else
109 !           return;
110 !     }
111       p += len;
112   #ifdef FEAT_MBYTE
113       c = mb_ptr2char(p);
114 ***************
115 *** 4100,4105 ****
116 --- 4124,4144 ----
117                 && compl_shown_match->cp_next != NULL
118                 && compl_shown_match->cp_next != compl_first_match)
119             compl_shown_match = compl_shown_match->cp_next;
120
121 +       /* If we didn't find it searching forward, and compl_shows_dir is
122 +        * backward, find the last match. */
123 +       if (compl_shows_dir == BACKWARD
124 +               && !ins_compl_equal(compl_shown_match,
125 +                                     compl_leader, (int)STRLEN(compl_leader))
126 +               && (compl_shown_match->cp_next == NULL
127 +                   || compl_shown_match->cp_next == compl_first_match))
128 +       {
129 +           while (!ins_compl_equal(compl_shown_match,
130 +                                     compl_leader, (int)STRLEN(compl_leader))
131 +                   && compl_shown_match->cp_prev != NULL
132 +                   && compl_shown_match->cp_prev != compl_first_match)
133 +               compl_shown_match = compl_shown_match->cp_prev;
134 +       }
135       }
136   
137       if (allow_get_expansion && insert_match
138 *** ../vim-7.0.012/src/version.c        Thu May 11 19:30:09 2006
139 --- src/version.c       Fri May 12 19:03:32 2006
140 ***************
141 *** 668,669 ****
142 --- 668,671 ----
143   {   /* Add new patch number below this line */
144 + /**/
145 +     13,
146   /**/
147
148 -- 
149 I'm writing a book.  I've got the page numbers done.
150
151  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
152 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
153 \\\        download, build and distribute -- http://www.A-A-P.org        ///
154  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.038127 seconds and 3 git commands to generate.