Fix bug in search() loop

Do not accept current cursor position in search after first
iteration to prevent infinite loop.