aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2015-07-01 14:29:36 +0000
committerokan2015-07-01 14:29:36 +0000
commit9249ec4a404cccff818bffa4430d447515184f1a (patch)
treedd72da3532c6e7dacff8f10ef6375b3c7a60c0f0
parent8b687bf04b3412df21ad38e31d0ad54e983b5114 (diff)
downloadcwm-9249ec4a404cccff818bffa4430d447515184f1a.tar.gz
only special case label matches (and still list); get rid of the rest - matchname is complete enough
-rw-r--r--search.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/search.c b/search.c
index d04221d..ccb6c88 100644
--- a/search.c
+++ b/search.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: search.c,v 1.46 2015/06/30 18:54:12 okan Exp $
+ * $OpenBSD: search.c,v 1.47 2015/07/01 14:29:36 okan Exp $
*/
#include <sys/types.h>
@@ -148,35 +148,12 @@ search_print_client(struct menu *mi, int list)
else if (cc->flags & CLIENT_HIDDEN)
flag = '&';
- if (list)
+ if ((list) || (cc->matchname == cc->label))
cc->matchname = cc->name;
(void)snprintf(mi->print, sizeof(mi->print), "(%d) %c[%s] %s",
cc->group ? cc->group->num : 0, flag,
cc->label ? cc->label : "", cc->matchname);
-
- if (!list && cc->matchname != cc->name &&
- strlen(mi->print) < sizeof(mi->print) - 1) {
- const char *marker = "";
- char buf[MENU_MAXENTRY + 1];
- int diff;
-
- diff = sizeof(mi->print) - 1 - strlen(mi->print);
-
- /* One for the ':' */
- diff -= 1;
-
- if (strlen(cc->name) > diff) {
- marker = "..";
- diff -= 2;
- } else {
- diff = strlen(cc->name);
- }
-
- (void)strlcpy(buf, mi->print, sizeof(buf));
- (void)snprintf(mi->print, sizeof(mi->print),
- "%s:%.*s%s", buf, diff, cc->name, marker);
- }
}
static void