Red Hat 7 terminal does not open in cwd

1

I just got upgraded to Red Hat 7 and am getting used to the changes. One thing I immediately noticed was that when I press Ctrl-Shift-T to open a new terminal tab, it defaults to / rather than the current directory, which is very frustrating.

I am using gnome terminal 3.8.4. I found what looks like the same issue in Ubuntu with a suggested .bashrc fix, but my organization uses tcsh and adding that line does not work.

Is this a known issue in RH7? How can I fix it?

user812786

Posted 2015-10-15T22:17:41.843

Reputation: 193

Answers

1

Basically you'll have to port vte.sh to tcsh. What it does is: before each prompt, it prints a certain escape sequence that contains the directory, in URI-encoded form. The escape sequence is the so-called OSC 7, e.g. \e]7;file:///home/username\a.

It seems tcsh does have a precmd (and even a cwdcmd) feature so it can be done, but unfortunately I'm not familiar with tcsh at all to quickly do it for you. I hope that you can do it for yourself with this bit of help.

Edit: The complicated part is URL-encoding. For start, you can omit this and simply echo \e]7;file://$PWD\a. It will work incorrectly for a few special characters you might probably never hit.

Edit: This one works for me as the simple (not properly URI-escaping) version:

alias precmd 'echo -n "\e]7;file://$PWD\a"'

egmont

Posted 2015-10-15T22:17:41.843

Reputation: 1 791

Thanks for the explanation! This is working for me, I haven't run into special characters yet but will update if I do. – user812786 – 2015-10-19T13:22:39.513

'%' is definitely such a special characters; so are '\a' (which is extremely unlikely to occur in a filename) and perhaps '\n' and friends (which are also unlikely). I'm really unsure about accented letters. In practice, you'll probably be just happy with the current solution and even if you encounter one of these characters then it's simpler to go on without changing the code and just accepting this little breakage :) (For a mainstream solution included in vte we'd need to figure it out properly.) – egmont – 2015-10-19T22:37:37.903

1

I've added us a (really low priority) reminder: https://bugzilla.gnome.org/show_bug.cgi?id=756830. I can't guarantee we'll address it in the foreseeable future.

– egmont – 2015-10-19T22:40:59.853