When starting XTerm the prompt starts at the first line of the terminal. When running commands the prompt moves down until it reaches the bottom, and from then on it stays there (not even Shift-Page Down or the mouse can change this). Rather than have the start of the terminal lifetime be "special" the prompt should always be at the bottom of the terminal. Please note that I have a multi-line prompt.
Of course, it should otherwise work as before (resizeable, scrollable, no unnecessary newlines in the output, and no output mysteriously disappearing), so
PROMPT_COMMAND='echo;echo;...' or similar is not an option. The solution ideally should not be shell-specific.
Edit: The current solution, while working in simple cases, has a few issues:
- It's Bash specific. An ideal solution should be portable to other shells.
- It fails if other processes modify
PS1. One example is virtualenv, which adds
(virtualenv)at the start of
PS1, which then always disappears just above the fold.
- Ctrl-l now removes the last page of history.
Is there a way to avoid these issues, short of forking XTerm?