4 source/macro.c | 9 ++++++++-
5 source/tags.c | 16 +++++++++-------
7 4 files changed, 21 insertions(+), 11 deletions(-)
9 diff --quilt old/source/macro.c new/source/macro.c
10 --- old/source/macro.c
11 +++ new/source/macro.c
12 @@ -3368,10 +3368,11 @@ static void stringDialogEscCB(Widget w,
13 ** "right": Put the right edge of the calltip at the position
14 ** "center" and "right" cannot both be specified.
15 ** "above": Place the calltip above the position
16 ** "strict": Don't move the calltip to keep it on-screen and away
17 ** from the cursor's line.
18 +** "ignore": Don't show calltip, if nothing is found
20 ** Returns the new calltip's ID on success, 0 on failure.
22 ** Does this need to go on IgnoredActions? I don't think so, since
23 ** showing a calltip may be part of the action you want to learn.
24 @@ -3382,10 +3383,11 @@ static int calltipMS(WindowInfo *window,
25 char stringStorage[TYPE_INT_STR_SIZE(int)], *tipText, *txtArg;
26 Boolean anchored = False, lookup = True;
28 int anchorPos, hAlign = TIP_LEFT, vAlign = TIP_BELOW,
29 alignMode = TIP_SLOPPY;
30 + Boolean ignore = False;
32 /* Read and check the string */
34 *errMsg = "%s subroutine called with too few arguments";
36 @@ -3442,20 +3444,25 @@ static int calltipMS(WindowInfo *window,
37 else if (!strcmp(txtArg, "tagKey"))
43 + if (strcmp(txtArg, "ignore"))
52 result->tag = INT_TAG;
53 if (mode < 0) lookup = False;
54 /* Look up (maybe) a calltip and display it */
55 result->val.n = ShowTipString( window, tipText, anchored, anchorPos, lookup,
56 - mode, hAlign, vAlign, alignMode );
57 + mode, hAlign, vAlign, alignMode, ignore );
62 /* This is how the (more informative) global var. version would work,
63 diff --quilt old/source/tags.c new/source/tags.c
66 @@ -115,11 +115,12 @@ static int addTag(const char *name, cons
67 const char *search, int posInf, const char *path,
69 static int delTag(const char *name, const char *file, int lang,
70 const char *search, int posInf, int index);
71 static tag *getTag(const char *name, int search_type);
72 -static int findDef(WindowInfo *window, const char *value, int search_type);
73 +static int findDef(WindowInfo *window, const char *value, int search_type,
75 static int findAllMatches(WindowInfo *window, const char *string);
76 static void findAllCB(Widget parent, XtPointer client_data, XtPointer call_data);
77 static Widget createSelectMenu(Widget parent, char *label, int nArgs,
79 static void editTaggedLocation( Widget parent, int i );
80 @@ -855,11 +856,12 @@ int LookupTag(const char *name, const ch
83 ** This code path is followed if the request came from either
84 ** FindDefinition or FindDefCalltip. This should probably be refactored.
86 -static int findDef(WindowInfo *window, const char *value, int search_type) {
87 +static int findDef(WindowInfo *window, const char *value, int search_type,
89 static char tagText[MAX_TAG_LEN + 1];
91 char message[MAX_TAG_LEN+40];
92 int l, ml, status = 0;
94 @@ -880,11 +882,11 @@ static int findDef(WindowInfo *window, c
95 if (status == 0 && search_type == TIP && TagsFileList != NULL) {
96 searchMode = TIP_FROM_TAG;
97 status = findAllMatches(window, tagText);
101 + if (status == 0 && !ignore) {
102 /* Didn't find any matches */
103 if (searchMode == TIP_FROM_TAG || searchMode == TIP) {
104 sprintf(message, "No match for \"%s\" in calltips or tags.",
106 tagsShowCalltip( window, message );
107 @@ -916,11 +918,11 @@ static int findDef(WindowInfo *window, c
108 static void findDefinitionHelper(WindowInfo *window, Time time, const char *arg,
113 - findDef(window, arg, search_type);
114 + findDef(window, arg, search_type, False);
118 searchMode = search_type;
119 XtGetSelectionValue(window->textArea, XA_PRIMARY, XA_STRING,
120 @@ -957,11 +959,11 @@ static void findDefCB(Widget widget, Win
122 /* skip if we can't get the selection data, or it's obviously too long */
123 if (*type == XT_CONVERT_FAIL || value == NULL) {
124 XBell(TheDisplay, 0);
126 - findDef(window, value, searchMode);
127 + findDef(window, value, searchMode, False);
133 @@ -971,11 +973,11 @@ static void findDefCB(Widget widget, Win
134 ** tip and/or tag database depending on search_type
135 ** search_type: Either TIP or TIP_FROM_TAG
137 int ShowTipString(WindowInfo *window, char *text, Boolean anchored,
138 int pos, Boolean lookup, int search_type, int hAlign, int vAlign,
140 + int alignMode, Boolean ignore) {
142 if (search_type == TAG) return 0;
144 /* So we don't have to carry all of the calltip alignment info around */
145 globAnchored = anchored;
146 @@ -986,11 +988,11 @@ int ShowTipString(WindowInfo *window, ch
148 /* If this isn't a lookup request, just display it. */
150 return tagsShowCalltip(window, text);
152 - return findDef(window, text, search_type);
153 + return findDef(window, text, search_type, ignore);
156 /* store all of the info into a pre-allocated tags struct */
157 static void setTag(tag *t, const char *name, const char *file,
158 int language, const char *searchString, int posInf,
159 diff --quilt old/source/tags.h new/source/tags.h
160 --- old/source/tags.h
161 +++ new/source/tags.h
162 @@ -65,8 +65,8 @@ void FindDefCalltip(WindowInfo *window,
164 /* Display (possibly finding first) a calltip. Search type can only be
165 TIP or TIP_FROM_TAG here. */
166 int ShowTipString(WindowInfo *window, char *text, Boolean anchored,
167 int pos, Boolean lookup, int search_type, int hAlign, int vAlign,
169 + int alignMode, Boolean ignore);
171 #endif /* NEDIT_TAGS_H_INCLUDED */
172 diff --quilt old/doc/help.etx new/doc/help.etx
175 @@ -2672,12 +2672,13 @@ Macro Subroutines
176 the right edge of the calltip with the position. ("center" and "right" may
177 not both be used.) "above" places the calltip above the position. "strict"
178 does not allow the calltip to move from its position in order to avoid going
179 off-screen or obscuring the cursor.
181 - Returns the ID of the calltip if it was found and/or displayed correctly,
183 + Returns the ID of the calltip if it was found and/or displayed correctly, 0
184 + otherwise, in this case a calltp will be shown with an error messages, which
185 + can be supressed with the "ignore" argument.
187 **clipboard_to_string()**
188 Returns the contents of the clipboard as a macro string. Returns empty