Does libedit have that function?

Should we write some C to expose this function to gitsh?

Alternatively we could write a small parser that's used only during tab completion.