diff --git a/dmenu.c b/dmenu.c index ae5f694..da66121 100644 --- a/dmenu.c +++ b/dmenu.c @@ -605,9 +605,9 @@ insert: case XK_Tab: if (!sel) return; - strncpy(text, sel->text, sizeof text - 1); + cursor = strnlen(sel->text, sizeof text - 1); + memcpy(text, sel->text, cursor); text[sizeof text - 1] = '\0'; - cursor = strlen(text); match(); break; }