comparison src/tag.c @ 2713:d20d37ef86c8 v7.3.129

updated for version 7.3.129 Problem: Using integer like a boolean. Solution: Nicer check for integer being non-zero.
author Bram Moolenaar <bram@vim.org>
date Fri, 25 Feb 2011 15:13:48 +0100
parents 1a0d346695fa
children c5e47b752f07
comparison
equal deleted inserted replaced
2712:43243f7ce351 2713:d20d37ef86c8
202 new_tag = TRUE; 202 new_tag = TRUE;
203 } 203 }
204 else 204 else
205 { 205 {
206 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 206 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
207 if (g_do_tagpreview) 207 if (g_do_tagpreview != 0)
208 use_tagstack = FALSE; 208 use_tagstack = FALSE;
209 else 209 else
210 #endif 210 #endif
211 use_tagstack = TRUE; 211 use_tagstack = TRUE;
212 212
220 || type == DT_CSCOPE 220 || type == DT_CSCOPE
221 #endif 221 #endif
222 )) 222 ))
223 { 223 {
224 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 224 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
225 if (g_do_tagpreview) 225 if (g_do_tagpreview != 0)
226 { 226 {
227 if (ptag_entry.tagname != NULL 227 if (ptag_entry.tagname != NULL
228 && STRCMP(ptag_entry.tagname, tag) == 0) 228 && STRCMP(ptag_entry.tagname, tag) == 0)
229 { 229 {
230 /* Jumping to same tag: keep the current match, so that 230 /* Jumping to same tag: keep the current match, so that
276 } 276 }
277 else 277 else
278 { 278 {
279 if ( 279 if (
280 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 280 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
281 g_do_tagpreview ? ptag_entry.tagname == NULL : 281 g_do_tagpreview != 0 ? ptag_entry.tagname == NULL :
282 #endif 282 #endif
283 tagstacklen == 0) 283 tagstacklen == 0)
284 { 284 {
285 /* empty stack */ 285 /* empty stack */
286 EMSG(_(e_tagstack)); 286 EMSG(_(e_tagstack));
359 || type == DT_LTAG 359 || type == DT_LTAG
360 #endif 360 #endif
361 ) 361 )
362 { 362 {
363 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 363 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
364 if (g_do_tagpreview) 364 if (g_do_tagpreview != 0)
365 { 365 {
366 cur_match = ptag_entry.cur_match; 366 cur_match = ptag_entry.cur_match;
367 cur_fnum = ptag_entry.cur_fnum; 367 cur_fnum = ptag_entry.cur_fnum;
368 } 368 }
369 else 369 else
397 { 397 {
398 /* Save index for when selection is cancelled. */ 398 /* Save index for when selection is cancelled. */
399 prevtagstackidx = tagstackidx; 399 prevtagstackidx = tagstackidx;
400 400
401 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 401 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
402 if (g_do_tagpreview) 402 if (g_do_tagpreview != 0)
403 { 403 {
404 cur_match = ptag_entry.cur_match; 404 cur_match = ptag_entry.cur_match;
405 cur_fnum = ptag_entry.cur_fnum; 405 cur_fnum = ptag_entry.cur_fnum;
406 } 406 }
407 else 407 else
435 } 435 }
436 } 436 }
437 } 437 }
438 438
439 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 439 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
440 if (g_do_tagpreview) 440 if (g_do_tagpreview != 0)
441 { 441 {
442 if (type != DT_SELECT && type != DT_JUMP) 442 if (type != DT_SELECT && type != DT_JUMP)
443 { 443 {
444 ptag_entry.cur_match = cur_match; 444 ptag_entry.cur_match = cur_match;
445 ptag_entry.cur_fnum = cur_fnum; 445 ptag_entry.cur_fnum = cur_fnum;
490 * When desired match not found yet, try to find it (and others). 490 * When desired match not found yet, try to find it (and others).
491 */ 491 */
492 if (use_tagstack) 492 if (use_tagstack)
493 name = tagstack[tagstackidx].tagname; 493 name = tagstack[tagstackidx].tagname;
494 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 494 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
495 else if (g_do_tagpreview) 495 else if (g_do_tagpreview != 0)
496 name = ptag_entry.tagname; 496 name = ptag_entry.tagname;
497 #endif 497 #endif
498 else 498 else
499 name = tag; 499 name = tag;
500 other_name = (tagmatchname == NULL || STRCMP(tagmatchname, name) != 0); 500 other_name = (tagmatchname == NULL || STRCMP(tagmatchname, name) != 0);
618 for (i = 0; i < num_matches && !got_int; ++i) 618 for (i = 0; i < num_matches && !got_int; ++i)
619 { 619 {
620 parse_match(matches[i], &tagp); 620 parse_match(matches[i], &tagp);
621 if (!new_tag && ( 621 if (!new_tag && (
622 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 622 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
623 (g_do_tagpreview 623 (g_do_tagpreview != 0
624 && i == ptag_entry.cur_match) || 624 && i == ptag_entry.cur_match) ||
625 #endif 625 #endif
626 (use_tagstack 626 (use_tagstack
627 && i == tagstack[tagstackidx].cur_match))) 627 && i == tagstack[tagstackidx].cur_match)))
628 *IObuff = '>'; 628 *IObuff = '>';
960 tagstack[tagstackidx].cur_match = cur_match; 960 tagstack[tagstackidx].cur_match = cur_match;
961 tagstack[tagstackidx].cur_fnum = cur_fnum; 961 tagstack[tagstackidx].cur_fnum = cur_fnum;
962 ++tagstackidx; 962 ++tagstackidx;
963 } 963 }
964 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 964 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
965 else if (g_do_tagpreview) 965 else if (g_do_tagpreview != 0)
966 { 966 {
967 ptag_entry.cur_match = cur_match; 967 ptag_entry.cur_match = cur_match;
968 ptag_entry.cur_fnum = cur_fnum; 968 ptag_entry.cur_fnum = cur_fnum;
969 } 969 }
970 #endif 970 #endif
3108 #ifdef FEAT_GUI 3108 #ifdef FEAT_GUI
3109 need_mouse_correct = TRUE; 3109 need_mouse_correct = TRUE;
3110 #endif 3110 #endif
3111 3111
3112 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 3112 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
3113 if (g_do_tagpreview) 3113 if (g_do_tagpreview != 0)
3114 { 3114 {
3115 postponed_split = 0; /* don't split again below */ 3115 postponed_split = 0; /* don't split again below */
3116 curwin_save = curwin; /* Save current window */ 3116 curwin_save = curwin; /* Save current window */
3117 3117
3118 /* 3118 /*
3146 if (keep_help) 3146 if (keep_help)
3147 { 3147 {
3148 /* A :ta from a help file will keep the b_help flag set. For ":ptag" 3148 /* A :ta from a help file will keep the b_help flag set. For ":ptag"
3149 * we need to use the flag from the window where we came from. */ 3149 * we need to use the flag from the window where we came from. */
3150 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 3150 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
3151 if (g_do_tagpreview) 3151 if (g_do_tagpreview != 0)
3152 keep_help_flag = curwin_save->w_buffer->b_help; 3152 keep_help_flag = curwin_save->w_buffer->b_help;
3153 else 3153 else
3154 #endif 3154 #endif
3155 keep_help_flag = curbuf->b_help; 3155 keep_help_flag = curbuf->b_help;
3156 } 3156 }
3320 foldOpenCursor(); 3320 foldOpenCursor();
3321 #endif 3321 #endif
3322 } 3322 }
3323 3323
3324 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) 3324 #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
3325 if (g_do_tagpreview && curwin != curwin_save && win_valid(curwin_save)) 3325 if (g_do_tagpreview != 0
3326 && curwin != curwin_save && win_valid(curwin_save))
3326 { 3327 {
3327 /* Return cursor to where we were */ 3328 /* Return cursor to where we were */
3328 validate_cursor(); 3329 validate_cursor();
3329 redraw_later(VALID); 3330 redraw_later(VALID);
3330 win_enter(curwin_save, TRUE); 3331 win_enter(curwin_save, TRUE);