-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to persist the Pane's working directory if we know what it is. #11374
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a really cool idea, I love it
src/cascadia/TerminalApp/Pane.cpp
Outdated
if (!_control.WorkingDirectory().empty()) | ||
{ | ||
args.StartingDirectory(_control.WorkingDirectory()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can prevent the double-COM-call with
if (!_control.WorkingDirectory().empty()) | |
{ | |
args.StartingDirectory(_control.WorkingDirectory()); | |
} | |
if (const auto path = _control.WorkingDirectory(); !path.empty()) | |
{ | |
args.StartingDirectory(path); | |
} |
I love the syntax... it strongly reminds me of Go.
…put multiple statements into an if, although I dont know if I like it. Seems like this was added in c++17 so thats why I didnt know about it
That commit message made me genuinely laugh aloud. 😄 To be fair in Go their use is a bit more prevalent as the language lacks sum types (just like C++, but their tuples are way more ergonomic, so...). if value, found := myHashMap[foo]; found {
...
} But I still find it useful in C++, since you never know if a getter is a trivial or - for the lack of better words - a "computing" one and I'm trying to proactively avoid hitting issues with the latter kind. Please feel free to disagree in reviews though. :) |
I was completely ok with the |
Hello @zadjii-msft! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
🎉 Handy links: |
Summary of the Pull Request
Try to save the working directory if we know what it is (just copied what was done in duplicating a pane). I overlooked this in my original implementation that always used the settings StartingDirectory.
References
#9800
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Tried setting the working directory using the OSC 9;9 escape and confirmed that the directory saves correctly.