/************************************************************************ * "Epsilon" is a registered trademark licensed to Lugaru Software, Ltd. * * "EEL" and "Lugaru" are trademarks of Lugaru Software, Ltd. * * * * Copyright (C) 1988, 1992 Lugaru Software Ltd. All rights reserved. * * * * Limited permission is hereby granted to reproduce and modify this * * copyrighted material provided that the resulting code is used only in * * conjunction with Lugaru products and that this notice is retained in * * any such reproduction or modification. * ************************************************************************/ /* Fixed version of do_go_tag() in Epsilon 6.03. This bug caused goto-tag and pluck-tag to fail to find tags, or sometimes even to lock up. */ #include "eel.h" short _tags_buffer; /* buffer number, for speed */ do_go_tag(s) /* go to tag s, ret 0=ok, 1=no such tag, 2=tag moved */ char *s; /* if s is empty, look for a duplicate tag */ { char pat[FNAMELEN], temp[FNAMELEN], *file, *p; int pos, oldbuf = bufnum; bufnum = _tags_buffer; if (*s) { if (p = index(s, '\t')) { strcpy(_last_tag_file, p + 1); *p = 0; /* remove file name from s */ if (p = index(_last_tag_file, '\t')) *p = 0; } else *_last_tag_file = 0; strcpy(_last_tag, s); if (!*_last_tag) /* no last tag */ return 0; if (*_last_tag_file) sprintf(pat, "^%q\t%q\t.*", _last_tag, _last_tag_file); else sprintf(pat, "^%q\t.*", _last_tag); point = 0; if (!re_search(1, pat)) /* look for 1st */ return 1; } else { /* find next matching tag */ pos = point; sprintf(pat, "^%q\t.*", _last_tag); if (!re_search(1, pat)) { /* look for next match */ save_var narrow_end = size() - pos, bufnum; point = 0; if (!re_search(1, pat)) /* look for 1st */ return 1; } } grab(matchstart, point, pat); /* tag, file, pos */ file = index(pat, '\t'); *file++ = 0; p = index(file, '\t'); /* find start of pos */ pos = strtoi(p + 1, 10); *p = 0; p = index(p + 1, '\t'); /* if p, p+1 has line's text */ strcpy(_last_tag_file, file); strcpy(temp, file); bufnum = oldbuf; absolute(temp); locate_window("", temp); find_it(temp, strip_returns.default); sprintf(temp, "%q[^a-zA-Z0-9_]", _last_tag); point = pos; if (!parse_string(1, temp, NULL)) { if (!p || !prox_line_search(p + 1)) /* search by text */ return 2; to_begin_line(); } window_start = prev_screen_line(show_tag_line); return 0; }