3 source/tags.c | 57 ++++++++++++++++++++++++++-------------------------------
4 1 file changed, 26 insertions(+), 31 deletions(-)
6 diff --quilt old/source/tags.c new/source/tags.c
9 @@ -100,12 +100,10 @@ typedef struct _tag {
12 enum searchDirection {FORWARD, BACKWARD};
14 static int loadTagsFile(const char *tagSpec, int index, int recLevel);
15 -static void findDefCB(Widget widget, WindowInfo *window, Atom *sel,
16 - Atom *type, char *value, int *length, int *format);
17 static void setTag(tag *t, const char *name, const char *file,
18 int language, const char *searchString, int posInf,
20 static int fakeRegExSearch(WindowInfo *window, char *buffer,
21 const char *searchString, int *startPos, int *endPos);
22 @@ -863,11 +861,10 @@ int LookupTag(const char *name, const ch
23 ** returns the calltip ID, or 0 on failure.
25 static int findDef(WindowInfo *window, const char *value, int search_type) {
26 static char tagText[MAX_TAG_LEN + 1];
28 - char message[MAX_TAG_LEN+40];
29 int l, ml, status = 0;
31 searchMode = search_type;
33 if (l <= MAX_TAG_LEN) {
34 @@ -891,16 +888,11 @@ static int findDef(WindowInfo *window, c
38 /* Didn't find any matches */
40 - if (searchMode == TIP_FROM_TAG || searchMode == TIP) {
41 - sprintf(message, "No match for \"%s\" in calltips or tags.",
43 - tagsShowCalltip( window, message );
46 + if (searchMode != TIP_FROM_TAG && searchMode != TIP) {
47 DialogF(DF_WARN, window->textArea, 1, "Tags",
48 "\"%s\" not found in tags file%s", "OK", tagName,
49 (TagsFileList && TagsFileList->next) ? "s" : "");
52 @@ -920,59 +912,62 @@ static int findDef(WindowInfo *window, c
54 ** Lookup the definition for the current primary selection the currently
55 ** loaded tags file and bring up the file and line that the tags file
58 -static void findDefinitionHelper(WindowInfo *window, Time time, const char *arg,
59 +static int findDefinitionHelper(WindowInfo *window, Time time, char **arg,
65 - findDef(window, arg, search_type);
69 - searchMode = search_type;
70 - XtGetSelectionValue(window->textArea, XA_PRIMARY, XA_STRING,
71 - (XtSelectionCallbackProc)findDefCB, window, time);
72 + *arg = GetAnySelection(window);
74 + XBell(TheDisplay, 0);
79 + return findDef(window, *arg, search_type);
85 void FindDefinition(WindowInfo *window, Time time, const char *arg)
87 - findDefinitionHelper(window, time, arg, TAG);
88 + char *usedArg = (char *)arg;
89 + findDefinitionHelper(window, time, &usedArg, TAG);
90 + if (usedArg != arg) {
98 void FindDefCalltip(WindowInfo *window, Time time, const char *arg)
101 + char message[MAX_TAG_LEN + 40];
102 + char *usedArg = (char *)arg;
104 /* Reset calltip parameters to reasonable defaults */
105 globAnchored = False;
107 globHAlign = TIP_LEFT;
108 globVAlign = TIP_BELOW;
109 globAlignMode = TIP_SLOPPY;
111 - findDefinitionHelper(window, time, arg, TIP);
113 + cID = findDefinitionHelper(window, time, &usedArg, TIP);
114 + if (cID <= 0 && NULL != usedArg && '\0' != usedArg[0]) {
115 + sprintf(message, "No match for \"%s\" in calltips or tags.", usedArg);
116 + tagsShowCalltip(window, message);
119 -/* Callback function for FindDefinition */
120 -static void findDefCB(Widget widget, WindowInfo *window, Atom *sel,
121 - Atom *type, char *value, int *length, int *format)
123 - /* skip if we can't get the selection data, or it's obviously too long */
124 - if (*type == XT_CONVERT_FAIL || value == NULL) {
125 - XBell(TheDisplay, 0);
127 - findDef(window, value, searchMode);
128 + if (usedArg != arg) {
135 ** Try to display a calltip
136 ** anchored: If true, tip appears at position pos