More progress in internal functions in readline

reading characters is really painful. Probably should have kept with the
previous implementation and just started to handle control characters
rather than trying to do a direct line-for-line port.