comparison src/edit.c @ 829:dc8197342755 v7.0d04

updated for version 7.0d04
author vimboss
date Fri, 14 Apr 2006 20:42:25 +0000
parents 01583c79d5f4
children 8bebcabccc2c
comparison
equal deleted inserted replaced
828:01583c79d5f4 829:dc8197342755
2138 /* match-fname is: 2138 /* match-fname is:
2139 * - compl_curr_match->cp_fname if it is a string equal to fname. 2139 * - compl_curr_match->cp_fname if it is a string equal to fname.
2140 * - a copy of fname, FREE_FNAME is set to free later THE allocated mem. 2140 * - a copy of fname, FREE_FNAME is set to free later THE allocated mem.
2141 * - NULL otherwise. --Acevedo */ 2141 * - NULL otherwise. --Acevedo */
2142 if (fname != NULL 2142 if (fname != NULL
2143 && compl_curr_match 2143 && compl_curr_match != NULL
2144 && compl_curr_match->cp_fname != NULL 2144 && compl_curr_match->cp_fname != NULL
2145 && STRCMP(fname, compl_curr_match->cp_fname) == 0) 2145 && STRCMP(fname, compl_curr_match->cp_fname) == 0)
2146 match->cp_fname = compl_curr_match->cp_fname; 2146 match->cp_fname = compl_curr_match->cp_fname;
2147 else if (fname != NULL) 2147 else if (fname != NULL)
2148 { 2148 {
2499 compl_match_array = (pumitem_T *)alloc_clear( 2499 compl_match_array = (pumitem_T *)alloc_clear(
2500 (unsigned)(sizeof(pumitem_T) 2500 (unsigned)(sizeof(pumitem_T)
2501 * compl_match_arraysize)); 2501 * compl_match_arraysize));
2502 if (compl_match_array != NULL) 2502 if (compl_match_array != NULL)
2503 { 2503 {
2504 /* If the current match is the original text don't find the first
2505 * match after it, don't highlight anything. */
2506 if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
2507 shown_match_ok = TRUE;
2508
2504 i = 0; 2509 i = 0;
2505 compl = compl_first_match; 2510 compl = compl_first_match;
2506 do 2511 do
2507 { 2512 {
2508 if ((compl->cp_flags & ORIGINAL_TEXT) == 0 2513 if ((compl->cp_flags & ORIGINAL_TEXT) == 0
2569 /* popup menu already exists, only need to find the current item.*/ 2574 /* popup menu already exists, only need to find the current item.*/
2570 for (i = 0; i < compl_match_arraysize; ++i) 2575 for (i = 0; i < compl_match_arraysize; ++i)
2571 if (compl_match_array[i].pum_text == compl_shown_match->cp_str 2576 if (compl_match_array[i].pum_text == compl_shown_match->cp_str
2572 || compl_match_array[i].pum_text 2577 || compl_match_array[i].pum_text
2573 == compl_shown_match->cp_text[CPT_ABBR]) 2578 == compl_shown_match->cp_text[CPT_ABBR])
2579 {
2580 cur = i;
2574 break; 2581 break;
2575 cur = i; 2582 }
2576 } 2583 }
2577 2584
2578 if (compl_match_array != NULL) 2585 if (compl_match_array != NULL)
2579 { 2586 {
2580 /* Compute the screen column of the start of the completed text. 2587 /* Compute the screen column of the start of the completed text.
2949 /* Deleted more than what was used to find matches, need to look for 2956 /* Deleted more than what was used to find matches, need to look for
2950 * matches all over again. */ 2957 * matches all over again. */
2951 ins_compl_free(); 2958 ins_compl_free();
2952 compl_started = FALSE; 2959 compl_started = FALSE;
2953 compl_matches = 0; 2960 compl_matches = 0;
2961 compl_cont_status = 0;
2962 compl_cont_mode = 0;
2954 } 2963 }
2955 2964
2956 line = ml_get_curline(); 2965 line = ml_get_curline();
2957 p = line + curwin->w_cursor.col; 2966 p = line + curwin->w_cursor.col;
2958 mb_ptr_back(line, p); 2967 mb_ptr_back(line, p);
2980 /* Remove the completed word again. */ 2989 /* Remove the completed word again. */
2981 ins_compl_delete(); 2990 ins_compl_delete();
2982 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col); 2991 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
2983 } 2992 }
2984 } 2993 }
2994
2995 /* Go to the original text, since none of the matches is inserted. */
2996 if (compl_first_match->cp_prev != NULL
2997 && (compl_first_match->cp_prev->cp_flags & ORIGINAL_TEXT))
2998 compl_shown_match = compl_first_match->cp_prev;
2999 else
3000 compl_shown_match = compl_first_match;
3001 compl_curr_match = compl_shown_match;
3002 compl_shows_dir = compl_direction;
2985 3003
2986 /* Show the popup menu with a different set of matches. */ 3004 /* Show the popup menu with a different set of matches. */
2987 ins_compl_show_pum(); 3005 ins_compl_show_pum();
2988 compl_used_match = FALSE; 3006 compl_used_match = FALSE;
2989 compl_enter_selects = FALSE; 3007 compl_enter_selects = FALSE;