lib/widget/input_complete.c: minor refactoring and optimization.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>