0001-history.patch (4,920 bytes)
From b23e181a11a11e4ee23321326f9231caf45f529f Mon Sep 17 00:00:00 2001
From: firebie <firebie@gmail.com>
Date: Wed, 4 Jun 2014 13:58:24 +0300
Subject: [PATCH] history
---
unicode_far/fileedit.cpp | 3 +++
unicode_far/filelist.cpp | 43 +++++++++++++++++++++++++++++++++----------
unicode_far/fileview.cpp | 7 +++++++
3 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/unicode_far/fileedit.cpp b/unicode_far/fileedit.cpp
index dd982cb..5fdc671 100644
--- a/unicode_far/fileedit.cpp
+++ b/unicode_far/fileedit.cpp
@@ -683,6 +683,9 @@ void FileEditor::Init(
if (GetExitCode() == XC_LOADING_INTERRUPTED || GetExitCode() == XC_OPEN_ERROR)
return;
+ if (!m_Flags.Check(FFILEEDIT_DISABLEHISTORY) && StrCmpI(strFileName.data(), MSG(MNewFileName)))
+ Global->CtrlObject->ViewHistory->AddToHistory(strFullFileName, m_editor->m_Flags.Check(Editor::FEDITOR_LOCKMODE) ? HR_EDITOR_RO : HR_EDITOR);
+
ShowConsoleTitle();
InitKeyBar();
m_windowKeyBar->SetOwner(this);
diff --git a/unicode_far/filelist.cpp b/unicode_far/filelist.cpp
index 2ee7a83..df6b24c 100644
--- a/unicode_far/filelist.cpp
+++ b/unicode_far/filelist.cpp
@@ -2739,8 +2739,6 @@ bool FileList::ChangeDir(const string& NewDir,bool ResolvePath,bool IsUpdated,co
string strInfoCurDir=NullToEmpty(Info.CurDir);
//string strInfoFormat=NullToEmpty(Info.Format);
string strInfoHostFile=NullToEmpty(Info.HostFile);
- string strInfoData=NullToEmpty(Info.ShortcutData);
- if(Info.Flags&OPIF_SHORTCUT) Global->CtrlObject->FolderHistory->AddToHistory(strInfoCurDir, HR_DEFAULT, &PluginManager::GetGUID(m_hPlugin), strInfoHostFile.data(), strInfoData.data());
/* $ 25.04.01 DJ
��� ������ SetDirectory �� ��������� ��������
*/
@@ -2779,6 +2777,20 @@ bool FileList::ChangeDir(const string& NewDir,bool ResolvePath,bool IsUpdated,co
SetDirectorySuccess=Global->CtrlObject->Plugins->SetDirectory(m_hPlugin,strSetDir,0,&UserData) != FALSE;
}
+ if (!PluginClosed)
+ {
+ OpenPanelInfo Info;
+ Global->CtrlObject->Plugins->GetOpenPanelInfo(m_hPlugin, &Info);
+ /* $ 16.01.2002 VVM
+ + ���� � ������� ��� OPIF_REALNAMES, �� ������ ����� �� ����� � ������ */
+ string strInfoCurDir = NullToEmpty(Info.CurDir);
+ //string strInfoFormat=NullToEmpty(Info.Format);
+ string strInfoHostFile = NullToEmpty(Info.HostFile);
+ string strInfoData = NullToEmpty(Info.ShortcutData);
+ if (Info.Flags&OPIF_SHORTCUT)
+ Global->CtrlObject->FolderHistory->AddToHistory(strInfoCurDir, HR_DEFAULT, &PluginManager::GetGUID(m_hPlugin), strInfoHostFile.data(), strInfoData.data());
+ }
+
ProcessPluginCommand();
// ����� ������ ������ ����� ����� ��������� ���������� �������, ���� ����� "Cannot find the file" - Mantis#1731
@@ -2796,14 +2808,6 @@ bool FileList::ChangeDir(const string& NewDir,bool ResolvePath,bool IsUpdated,co
}
else
{
- {
- string strFullNewDir;
- ConvertNameToFull(strSetDir, strFullNewDir);
-
- if (StrCmpI(strFullNewDir, m_CurDir))
- Global->CtrlObject->FolderHistory->AddToHistory(m_CurDir);
- }
-
if (dot2Present)
{
if (RootPath)
@@ -2879,10 +2883,21 @@ bool FileList::ChangeDir(const string& NewDir,bool ResolvePath,bool IsUpdated,co
setdisk(CurDisk);
}
}*/
+
+ string strOldCurDir = m_CurDir;
api::GetCurrentDirectory(m_CurDir);
+
if (!IsUpdated)
return SetDirectorySuccess;
+ {
+ string strFullNewDir;
+ ConvertNameToFull(m_CurDir, strFullNewDir);
+
+ //if (StrCmpI(strFullNewDir, strOldCurDir))
+ Global->CtrlObject->FolderHistory->AddToHistory(m_CurDir);
+ }
+
Update(UpdateFlags);
if (dot2Present)
@@ -6239,6 +6254,14 @@ void FileList::SetPluginMode(PluginHandle* hPlugin,const string& PluginFile,bool
OpenPanelInfo Info;
Global->CtrlObject->Plugins->GetOpenPanelInfo(hPlugin,&Info);
+ {
+ string strInfoCurDir = NullToEmpty(Info.CurDir);
+ string strInfoHostFile = NullToEmpty(Info.HostFile);
+ string strInfoData = NullToEmpty(Info.ShortcutData);
+ if (Info.Flags&OPIF_SHORTCUT)
+ Global->CtrlObject->FolderHistory->AddToHistory(strInfoCurDir, HR_DEFAULT, &PluginManager::GetGUID(hPlugin), strInfoHostFile.data(), strInfoData.data());
+ }
+
if (Info.StartPanelMode)
SetViewMode(VIEW_0+Info.StartPanelMode-L'0');
diff --git a/unicode_far/fileview.cpp b/unicode_far/fileview.cpp
index e54b27d..87aabdf 100644
--- a/unicode_far/fileview.cpp
+++ b/unicode_far/fileview.cpp
@@ -159,6 +159,13 @@ void FileViewer::Init(const string& name,int EnableSwitch,int disableHistory,
return;
}
+ if (!DisableHistory && (Global->CtrlObject->Cp()->ActivePanel() || m_Name != L"-"))
+ {
+ string strFullFileName;
+ m_View.GetFileName(strFullFileName);
+ Global->CtrlObject->ViewHistory->AddToHistory(strFullFileName, HR_VIEWER);
+ }
+
m_ExitCode=TRUE;
m_windowKeyBar->Show();
--
2.1.2.msysgit.0