View Issue Details

IDProjectCategoryView StatusLast Update
0003080Far ManagerFindFilespublic2015-10-03 18:08
Reporter4eyesAssigned ToDrKnS 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.0 
Target VersionFixed in Version3.0 
Summary0003080: [patch] Alternate editor/viewer in FindFile results
DescriptionFindFile results list doesn't support custom editor/viewer for found files.

Although FAR may use file associations or editor/viewer configuration for customizing files opening method, these settings aren't applied for FindFile results.

Patch is included to this issue.
Forum link: http://forum.farmanager.com/viewtopic.php?f=6&t=9797
Steps To Reproduce - create Edit file association, or set up external editor using Editor options;
 - start search in FindFile;
 - wait for a first results;
 - try to open external editor, or editor associated with 'file associations'
Additional InformationI think, it would be nice and consistent if file associations and Editor/Viewer options were working globally for any files list. This patch is a little step further.

Additionally, with this patch user may launch external editor/viewer while search still in progress, which is impossible from temporary panel. Moreover, sometimes ind results dialog is more handy then temporary panel, due to short file name, grouping, etc.

Feel free to contact me here or on forum, if there is any suggestions to my patch.

TagsNo tags attached.
Build4430

Activities

4eyes

2015-09-02 12:09

reporter  

4eyes

2015-09-02 20:21

reporter   bugnote:0013819

Last edited: 2015-09-02 20:22

View 2 revisions

looks like I've somehow excluded FarEng.hlf.m4 from the patch... Will update it in a few hours.

DrKnS

2015-09-02 21:23

administrator   bugnote:0013820

4411

4eyes

2015-09-03 15:44

reporter   bugnote:0013823

Still needs improvement for emulated filesystems. On one of my PCs, when opening alternate editor while searching inside .zip, it managed to delete temporary file faster then alternate editor starts up.

4eyes

2015-10-02 02:44

reporter   bugnote:0013958

Last edited: 2015-10-02 02:46

View 2 revisions

Fixed: temporary files will be deleted on FindFile closing. This should give enough time for external editor to open temporary file.

Fix is attached as 'unicode_far_r13428_FindFileList_fix.patch'

4eyes

2015-10-02 02:45

reporter  

unicode_far_r13428_FindFileList_fix.patch (1,756 bytes)
Index: findfile.cpp
===================================================================
--- findfile.cpp	(revision 13428)
+++ findfile.cpp	(working copy)
@@ -379,6 +379,16 @@
 	}
 };
 
+// RAII file deletion
+class DelayedDeleter : noncopyable
+{
+	std::wstring m_pathToDelete;
+
+public:
+	DelayedDeleter(const std::wstring pathToDelete) : m_pathToDelete(pathToDelete) {}
+	~DelayedDeleter() { DeleteFileWithFolder(m_pathToDelete); }
+};
+
 void FindFiles::InitInFileSearch()
 {
 	if (!InFileSearchInited && !strFindStr.empty())
@@ -1691,7 +1701,8 @@
 
 					if (RemoveTemp)
 					{
-						DeleteFileWithFolder(strSearchFileName);
+						// external editor may not have enough time to open this file, so deffer deletion
+						m_DelayedDeleters.emplace_back(strSearchFileName); 
 					}
 					return TRUE;
 				}
@@ -2956,7 +2967,8 @@
 	itd(std::make_unique<InterThreadData>()),
 	PauseEvent(Event::manual, Event::signaled),
 	StopEvent(Event::manual, Event::nonsignaled),
-	m_TimeCheck(time_check::immediate, GetRedrawTimeout())
+	m_TimeCheck(time_check::immediate, GetRedrawTimeout()),
+	m_DelayedDeleters()
 {
 	_ALGO(CleverSysLog clv(L"FindFiles::FindFiles()"));
 
Index: findfile.hpp
===================================================================
--- findfile.hpp	(revision 13428)
+++ findfile.hpp	(working copy)
@@ -55,6 +55,7 @@
 class filemasks;
 class FileFilter;
 struct FindListItem;
+class DelayedDeleter;
 
 class FindFiles: noncopyable
 {
@@ -128,6 +129,7 @@
 	std::unique_ptr<InterThreadData> itd;
 	struct CodePageInfo;
 	std::list<CodePageInfo> m_CodePages;
+	std::list<DelayedDeleter> m_DelayedDeleters;
 	CriticalSection PluginCS;
 	Event PauseEvent;
 	Event StopEvent;

DrKnS

2015-10-02 09:45

administrator   bugnote:0013959

4430.

Are you in our 'contributors' list already?

4eyes

2015-10-03 14:42

reporter   bugnote:0013961

> 4430
Build looks good, thanks.

> Are you in our 'contributors' list already?
No. My name is Victor Istomin.

Issue History

Date Modified Username Field Change
2015-09-02 12:09 4eyes New Issue
2015-09-02 12:09 4eyes File Added: unicode_far_r13359_FindFileList.patch
2015-09-02 20:19 DrKnS Assigned To => DrKnS
2015-09-02 20:19 DrKnS Status new => assigned
2015-09-02 20:21 4eyes Note Added: 0013819
2015-09-02 20:22 4eyes Note Edited: 0013819 View Revisions
2015-09-02 21:23 DrKnS Note Added: 0013820
2015-09-02 21:23 DrKnS Status assigned => feedback
2015-09-03 15:44 4eyes Note Added: 0013823
2015-09-03 15:44 4eyes Status feedback => assigned
2015-10-02 02:44 4eyes Note Added: 0013958
2015-10-02 02:45 4eyes File Added: unicode_far_r13428_FindFileList_fix.patch
2015-10-02 02:46 4eyes Note Edited: 0013958 View Revisions
2015-10-02 09:45 DrKnS Note Added: 0013959
2015-10-02 09:45 DrKnS Status assigned => feedback
2015-10-03 14:42 4eyes Note Added: 0013961
2015-10-03 14:42 4eyes Status feedback => assigned
2015-10-03 18:08 DrKnS Build => 4430
2015-10-03 18:08 DrKnS Status assigned => closed
2015-10-03 18:08 DrKnS Resolution open => fixed
2015-10-03 18:08 DrKnS Fixed in Version => 3.0