diff options
author | elfmz <fenix1905@tut.by> | 2022-09-03 01:20:34 +0300 |
---|---|---|
committer | elfmz <fenix1905@tut.by> | 2022-09-03 01:20:34 +0300 |
commit | 09e9fa095dbfed0eea24b06c09371a6ca08673d3 (patch) | |
tree | 5e3522572e73b30942869bd94e87ee6e1efcb8a2 /NetRocks | |
parent | c63950341be7e88c9f169b96d145dc22701975d8 (diff) |
NetRocks: fix some cosmetic issues when failed to open site
Diffstat (limited to 'NetRocks')
-rw-r--r-- | NetRocks/src/PluginImpl.cpp | 32 | ||||
-rw-r--r-- | NetRocks/src/PluginImpl.h | 2 |
2 files changed, 23 insertions, 11 deletions
diff --git a/NetRocks/src/PluginImpl.cpp b/NetRocks/src/PluginImpl.cpp index ae3cf792..f0113a91 100644 --- a/NetRocks/src/PluginImpl.cpp +++ b/NetRocks/src/PluginImpl.cpp @@ -240,6 +240,9 @@ static bool PreprocessPathTokens(std::vector<std::string> &components) int PluginImpl::SetDirectory(const wchar_t *Dir, int OpMode) { fprintf(stderr, "PluginImpl::SetDirectory('%ls', %d)\n", Dir, OpMode); + StackedDir sd; + StackedDirCapture(sd); + if (!_remote) { if (_sites_cfg_location.Change(Wide2MB(Dir))) { UpdatePathInfo(); @@ -254,9 +257,6 @@ int PluginImpl::SetDirectory(const wchar_t *Dir, int OpMode) site_specification = SiteSpecification(StrWide2MB(_standalone_config), _location.server); } - StackedDir sd; - StackedDirCapture(sd); - if (*Dir == L'/') { DismissRemoteHost(); @@ -789,18 +789,24 @@ bool PluginImpl::ByKey_TryEnterSelectedSite() if ( (gfi->FindData.dwFileAttributes & FILE_ATTRIBUTE_EXECUTABLE) == 0) { //&& wcscmp(gfi->FindData.lpwszFileName, G.GetMsgWide(MCreateSiteConnection)) == 0) { ByKey_EditSiteConnection(true); - return false; - + return true; } + StackedDir sd; + StackedDirCapture(sd); bool out = SetDirectoryInternal(gfi->FindData.lpwszFileName, 0); + if (!out) { + StackedDirApply(sd); + } UpdatePathInfo(); - G.info.Control(PANEL_ACTIVE, FCTL_UPDATEPANEL, 0, 0); - G.info.Control(PANEL_ACTIVE, FCTL_CLEARSELECTION, 0, 0); - PanelRedrawInfo ri = {}; - G.info.Control(PANEL_ACTIVE, FCTL_REDRAWPANEL, 0, (LONG_PTR)&ri); + if (out) { + G.info.Control(PANEL_ACTIVE, FCTL_UPDATEPANEL, 0, 0); + G.info.Control(PANEL_ACTIVE, FCTL_CLEARSELECTION, 0, 0); + PanelRedrawInfo ri = {}; + G.info.Control(PANEL_ACTIVE, FCTL_REDRAWPANEL, 0, (LONG_PTR)&ri); + } - return out; + return true; } void PluginImpl::ByKey_EditAttributesSelected() @@ -843,6 +849,8 @@ void PluginImpl::StackedDirCapture(StackedDir &sd) { sd.remote = _remote; sd.location = _location; + sd.sites_cfg_location = _sites_cfg_location; + sd.standalone_config = _standalone_config; } void PluginImpl::StackedDirApply(StackedDir &sd) @@ -856,6 +864,8 @@ void PluginImpl::StackedDirApply(StackedDir &sd) } } _location = sd.location; + _sites_cfg_location = sd.sites_cfg_location; + _standalone_config = sd.standalone_config; UpdatePathInfo(); } @@ -873,7 +883,7 @@ int PluginImpl::ProcessEventCommand(const wchar_t *cmd) StackedDirCapture(sd); const std::wstring &dir = GetCommandArgument(cmd); - if (SetDirectoryInternal(dir.empty() ? L"~" : dir.c_str(), 0)) { + if ((!_remote && (dir.empty() || dir == L".")) || SetDirectoryInternal(dir.empty() ? L"~" : dir.c_str(), 0)) { _dir_stack.emplace_back(sd); FakeExec(); } diff --git a/NetRocks/src/PluginImpl.h b/NetRocks/src/PluginImpl.h index 2701884e..0dd6c729 100644 --- a/NetRocks/src/PluginImpl.h +++ b/NetRocks/src/PluginImpl.h @@ -28,6 +28,8 @@ class PluginImpl { std::shared_ptr<IHost> remote; Location location; + SitesConfigLocation sites_cfg_location; + std::wstring standalone_config; }; std::deque<StackedDir> _dir_stack; |