Generic line editing and history functions.
