Tony Houghton - 2012-05-13

Ah, I had seen something like this before but couldn't reproduce it. Now I know how, but I don't think I can fix it. There are two things you can do to avoid the problem. One is to have bash set the terminal title whenever it prints a prompt. For example including the following in PS1 sets the title to the current directory (I think [\e]0; is the start sequence and \a] the end sequence) :

[\e]0;\w\a]

Alternatively set the window and tab title templates to %s on its own.

AFAICT the problem is because roxterm and gnome-terminal (in which I can reproduce a similar problem) allow the actual window title to be set to something different from the terminal title set by the program running in the terminal, and when the concept of a terminal title was invented nobody foresaw that the window title might not always exactly correspond to the terminal title, so there's no way to read a terminal title except by assuming the window title is the same and reading that.