Summary: | New tabs are sometime opened in a wrong directory | ||
---|---|---|---|
Product: | [Applications] konsole | Reporter: | Sylvain HENRY <hsyl20> |
Component: | general | Assignee: | Konsole Developer <konsole-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | kde-bugzilla, mboquien, robertknight |
Priority: | NOR | ||
Version: | 2.4 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 4.7 | |
Attachments: | Proposed patch |
Description
Sylvain HENRY
2010-02-16 10:54:20 UTC
Created attachment 40913 [details]
Proposed patch
This always annoyed me too... and you just reminded me that I should have a look at it. The problem is that currentWorkingDirectory() only returns cached information, and the cache is updated delayed.
Attached patch is only a dirty fix. The correct solution would be to add an invalidateWorkingDirectoryCache() method that just clears out the local variable, so that on next call the cache is updated.
Christoph, thanks for a solution to this. Can you provide the (more) "correct solution" maybe, too? :) *** Bug 189528 has been marked as a duplicate of this bug. *** I've marked bug 189528 as duplicate, but it is not directly the same, although probably related: Bug 189528 is about the internally saved cwd changing when you do e.g. "find /". Doing so, waiting a few seconds and opening a new tab will get you into some very random directory. I think Konsole should only update the current directory (used as starting point for new tabs) when a new prompt gets displayed. During the "find" or any other long running process, it may be fine to periodically update the cwd displayed in the title bar. However, the latter one should get updated instantly after "cd" / new prompt, too (see bug 207018). > I think Konsole should only update the current directory
> (used as starting point for new tabs) when a new prompt gets displayed.
The terminal has no understanding of the output of the programs running it in so you'd need to find some suitable heuristics.
The current heuristic is very simple, whenever input is received from the user, a timer is started which expires ~2 seconds later, at which point the current working directory of the program which has control of the terminal is recorded. The reason for the long timeout is to avoid the tab titles changing too frequently (see the Mac terminal application for an example of this problem).
Git commit ad9f8011c36cf86d79f8e72d027853391c94c101 by Kurt Hindenburg. Committed on 04/03/2011 at 20:34. Pushed by hindenburg into branch 'master'. Correct issue where new tabs start in wrong directories. Currently, Konsole only updates the tab folder ~2 seconds. After this patch, when a new tab is requested the working directory is updated. Patch by Christoph Feck. BUG: 227156 FIXED-IN: 4.7 M +10 -0 src/MainWindow.cpp http://commits.kde.org/konsole/ad9f8011c36cf86d79f8e72d027853391c94c101 Git commit edec4bedbc9a3ed49d79ac31a5c3d425a47dc47b by Kurt Hindenburg. Committed on 04/03/2011 at 20:34. Pushed by hindenburg into branch 'KDE/4.6'. Correct issue where new tabs start in wrong directories. Currently, Konsole only updates the tab folder ~2 seconds. After this patch, when a new tab is requested the working directory is updated. Patch by Christoph Feck. I don't see any reason this can't go in 4.6.x CCBUG: 227156 FIXED-IN: 4.7 (cherry picked from commit ad9f8011c36cf86d79f8e72d027853391c94c101) M +10 -0 src/MainWindow.cpp http://commits.kde.org/konsole/edec4bedbc9a3ed49d79ac31a5c3d425a47dc47b |