From 7898a2ff443efa4525e4845788bf5ee3b3c717b4 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 3 Jul 2013 23:13:21 +0000 Subject: [PATCH] [BUG_FIXED] (Author: Andreas Jonsson) Fix "Find all in current document" asking for creating a new file bug (regression). git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1068 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/ScitillaComponent/Buffer.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index c8c28bfd0..5fb2d7aec 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -893,21 +893,19 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea return success; } -/* -BufferID FileManager::getBufferFromName(const TCHAR * name) { +BufferID FileManager::getBufferFromName(const TCHAR * name) +{ + // Attempt to match by name first. TCHAR fullpath[MAX_PATH]; ::GetFullPathName(name, MAX_PATH, fullpath, NULL); ::GetLongPathName(fullpath, fullpath, MAX_PATH); - for(size_t i = 0; i < _buffers.size(); i++) { + for(size_t i = 0; i < _buffers.size(); i++) + { if (!lstrcmpi(name, _buffers.at(i)->getFullPathName())) return _buffers.at(i)->getID(); } - return BUFFER_INVALID; -} -*/ -BufferID FileManager::getBufferFromName(const TCHAR * name) -{ + // If no buffer matches exactly by name, try another method. HANDLE givenFile = ::CreateFile(name, GENERIC_READ, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,