libedit was written for just this purpose
https://github.com/NetBSD/src/tree/trunk/lib/libedit (cvsweb appears down)
https://github.com/NetBSD/src/tree/trunk/lib/libedit (cvsweb appears down)
really I just want to be able to find my previous command, and multi word-level edit it.