1 Subject: remove 'calltip not found'-tip in error case
3 This can be easily recreated by the user.
7 source/tags.c | 57 ++++++++++++++++++++++++++-------------------------------
8 1 file changed, 26 insertions(+), 31 deletions(-)
10 diff --quilt old/source/tags.c new/source/tags.c
13 @@ -100,12 +100,10 @@ typedef struct _tag {
16 enum searchDirection {FORWARD, BACKWARD};
18 static int loadTagsFile(const char *tagSpec, int index, int recLevel);
19 -static void findDefCB(Widget widget, WindowInfo *window, Atom *sel,
20 - Atom *type, char *value, int *length, int *format);
21 static void setTag(tag *t, const char *name, const char *file,
22 int language, const char *searchString, int posInf,
24 static int fakeRegExSearch(WindowInfo *window, char *buffer,
25 const char *searchString, int *startPos, int *endPos);
26 @@ -863,11 +861,10 @@ int LookupTag(const char *name, const ch
27 ** returns the calltip ID, or 0 on failure.
29 static int findDef(WindowInfo *window, const char *value, int search_type) {
30 static char tagText[MAX_TAG_LEN + 1];
32 - char message[MAX_TAG_LEN+40];
33 int l, ml, status = 0;
35 searchMode = search_type;
37 if (l <= MAX_TAG_LEN) {
38 @@ -891,16 +888,11 @@ static int findDef(WindowInfo *window, c
42 /* Didn't find any matches */
44 - if (searchMode == TIP_FROM_TAG || searchMode == TIP) {
45 - sprintf(message, "No match for \"%s\" in calltips or tags.",
47 - tagsShowCalltip( window, message );
50 + if (searchMode != TIP_FROM_TAG && searchMode != TIP) {
51 DialogF(DF_WARN, window->textArea, 1, "Tags",
52 "\"%s\" not found in tags file%s", "OK", tagName,
53 (TagsFileList && TagsFileList->next) ? "s" : "");
56 @@ -920,59 +912,62 @@ static int findDef(WindowInfo *window, c
58 ** Lookup the definition for the current primary selection the currently
59 ** loaded tags file and bring up the file and line that the tags file
62 -static void findDefinitionHelper(WindowInfo *window, Time time, const char *arg,
63 +static int findDefinitionHelper(WindowInfo *window, Time time, char **arg,
69 - findDef(window, arg, search_type);
73 - searchMode = search_type;
74 - XtGetSelectionValue(window->textArea, XA_PRIMARY, XA_STRING,
75 - (XtSelectionCallbackProc)findDefCB, window, time);
76 + *arg = GetAnySelection(window);
78 + XBell(TheDisplay, 0);
83 + return findDef(window, *arg, search_type);
89 void FindDefinition(WindowInfo *window, Time time, const char *arg)
91 - findDefinitionHelper(window, time, arg, TAG);
92 + char *usedArg = (char *)arg;
93 + findDefinitionHelper(window, time, &usedArg, TAG);
94 + if (usedArg != arg) {
102 void FindDefCalltip(WindowInfo *window, Time time, const char *arg)
105 + char message[MAX_TAG_LEN + 40];
106 + char *usedArg = (char *)arg;
108 /* Reset calltip parameters to reasonable defaults */
109 globAnchored = False;
111 globHAlign = TIP_LEFT;
112 globVAlign = TIP_BELOW;
113 globAlignMode = TIP_SLOPPY;
115 - findDefinitionHelper(window, time, arg, TIP);
117 + cID = findDefinitionHelper(window, time, &usedArg, TIP);
118 + if (cID <= 0 && NULL != usedArg && '\0' != usedArg[0]) {
119 + sprintf(message, "No match for \"%s\" in calltips or tags.", usedArg);
120 + tagsShowCalltip(window, message);
123 -/* Callback function for FindDefinition */
124 -static void findDefCB(Widget widget, WindowInfo *window, Atom *sel,
125 - Atom *type, char *value, int *length, int *format)
127 - /* skip if we can't get the selection data, or it's obviously too long */
128 - if (*type == XT_CONVERT_FAIL || value == NULL) {
129 - XBell(TheDisplay, 0);
131 - findDef(window, value, searchMode);
132 + if (usedArg != arg) {
139 ** Try to display a calltip
140 ** anchored: If true, tip appears at position pos