Fix file case problem.
Fix incremental search not using selected text. Fix Session not loaded using anything other than file->open menu. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@235 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
84b2a53819
commit
5529852d67
|
@ -470,6 +470,11 @@ bool Notepad_plus::loadSession(Session & session)
|
|||
for ( ; i < session.nbMainFiles() ; )
|
||||
{
|
||||
const char *pFn = session._mainViewFiles[i]._fileName.c_str();
|
||||
if (isFileSession(pFn)) {
|
||||
vector<sessionFileInfo>::iterator posIt = session._mainViewFiles.begin() + i;
|
||||
session._mainViewFiles.erase(posIt);
|
||||
continue; //skip session files, not supporting recursive sessions
|
||||
}
|
||||
if (PathFileExists(pFn)) {
|
||||
lastOpened = doOpen(pFn);
|
||||
} else {
|
||||
|
@ -512,6 +517,11 @@ bool Notepad_plus::loadSession(Session & session)
|
|||
for ( ; k < session.nbSubFiles() ; )
|
||||
{
|
||||
const char *pFn = session._subViewFiles[k]._fileName.c_str();
|
||||
if (isFileSession(pFn)) {
|
||||
vector<sessionFileInfo>::iterator posIt = session._subViewFiles.begin() + k;
|
||||
session._subViewFiles.erase(posIt);
|
||||
continue; //skip session files, not supporting recursive sessions
|
||||
}
|
||||
if (PathFileExists(pFn)) {
|
||||
lastOpened = doOpen(pFn);
|
||||
//check if already open in main. If so, clone
|
||||
|
@ -586,6 +596,7 @@ BufferID Notepad_plus::doOpen(const char *fileName, bool isReadOnly)
|
|||
{
|
||||
char longFileName[MAX_PATH];
|
||||
::GetFullPathName(fileName, MAX_PATH, longFileName, NULL);
|
||||
::GetLongPathName(longFileName, longFileName, MAX_PATH);
|
||||
|
||||
_lastRecentFileList.remove(longFileName);
|
||||
|
||||
|
@ -605,6 +616,11 @@ BufferID Notepad_plus::doOpen(const char *fileName, bool isReadOnly)
|
|||
}
|
||||
return test;
|
||||
}
|
||||
|
||||
if (isFileSession(longFileName) && PathFileExists(longFileName)) {
|
||||
fileLoadSession(longFileName);
|
||||
return BUFFER_INVALID;
|
||||
}
|
||||
|
||||
if (!PathFileExists(longFileName))
|
||||
{
|
||||
|
@ -882,14 +898,9 @@ void Notepad_plus::fileOpen()
|
|||
{
|
||||
size_t sz = pfns->size();
|
||||
for (size_t i = 0 ; i < sz ; i++) {
|
||||
if (isFileSession(pfns->at(i).c_str())) {
|
||||
fileLoadSession(pfns->at(i).c_str());
|
||||
lastOpened = BUFFER_INVALID;
|
||||
} else {
|
||||
BufferID test = doOpen(pfns->at(i).c_str(), fDlg.isReadOnly());
|
||||
if (test != BUFFER_INVALID)
|
||||
lastOpened = test;
|
||||
}
|
||||
BufferID test = doOpen(pfns->at(i).c_str(), fDlg.isReadOnly());
|
||||
if (test != BUFFER_INVALID)
|
||||
lastOpened = test;
|
||||
}
|
||||
}
|
||||
if (lastOpened != BUFFER_INVALID) {
|
||||
|
@ -2768,10 +2779,10 @@ void Notepad_plus::command(int id)
|
|||
const int strSize = 64;
|
||||
char str[strSize];
|
||||
|
||||
_incrementFindDlg.display();
|
||||
|
||||
_pEditView->getSelectedText(str, strSize);
|
||||
_incrementFindDlg.setSearchText(str, _pEditView->getCurrentBuffer()->getUnicodeMode() != uni8Bit);
|
||||
|
||||
_incrementFindDlg.display();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -367,9 +367,12 @@ BufferID FileManager::loadFile(const char * filename, Document doc) {
|
|||
doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT);
|
||||
}
|
||||
|
||||
char fullpath[MAX_PATH];
|
||||
::GetFullPathName(filename, MAX_PATH, fullpath, NULL);
|
||||
::GetLongPathName(fullpath, fullpath, MAX_PATH);
|
||||
Utf8_16_Read UnicodeConvertor; //declare here so we can get information after loading is done
|
||||
if (loadFileData(doc, filename, &UnicodeConvertor)) {
|
||||
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_REGULAR, filename);
|
||||
if (loadFileData(doc, fullpath, &UnicodeConvertor)) {
|
||||
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_REGULAR, fullpath);
|
||||
BufferID id = (BufferID) newBuf;
|
||||
newBuf->_id = id;
|
||||
_buffers.push_back(newBuf);
|
||||
|
@ -406,9 +409,12 @@ bool FileManager::saveBuffer(BufferID id, const char * filename, bool isCopy) {
|
|||
bool isSys = false;
|
||||
DWORD attrib;
|
||||
|
||||
if (PathFileExists(filename))
|
||||
char fullpath[MAX_PATH];
|
||||
::GetFullPathName(filename, MAX_PATH, fullpath, NULL);
|
||||
::GetLongPathName(fullpath, fullpath, MAX_PATH);
|
||||
if (PathFileExists(fullpath))
|
||||
{
|
||||
attrib = ::GetFileAttributes(filename);
|
||||
attrib = ::GetFileAttributes(fullpath);
|
||||
|
||||
if (attrib != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
|
@ -429,7 +435,7 @@ bool FileManager::saveBuffer(BufferID id, const char * filename, bool isCopy) {
|
|||
Utf8_16_Write UnicodeConvertor;
|
||||
UnicodeConvertor.setEncoding(mode);
|
||||
|
||||
FILE *fp = UnicodeConvertor.fopen(filename, "wb");
|
||||
FILE *fp = UnicodeConvertor.fopen(fullpath, "wb");
|
||||
if (fp)
|
||||
{
|
||||
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, buffer->_doc); //generate new document
|
||||
|
@ -449,17 +455,17 @@ bool FileManager::saveBuffer(BufferID id, const char * filename, bool isCopy) {
|
|||
UnicodeConvertor.fclose();
|
||||
|
||||
if (isHidden)
|
||||
::SetFileAttributes(filename, attrib | FILE_ATTRIBUTE_HIDDEN);
|
||||
::SetFileAttributes(fullpath, attrib | FILE_ATTRIBUTE_HIDDEN);
|
||||
|
||||
if (isSys)
|
||||
::SetFileAttributes(filename, attrib | FILE_ATTRIBUTE_SYSTEM);
|
||||
::SetFileAttributes(fullpath, attrib | FILE_ATTRIBUTE_SYSTEM);
|
||||
|
||||
if (isCopy) {
|
||||
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
|
||||
return true; //all done
|
||||
}
|
||||
|
||||
buffer->setFileName(filename);
|
||||
buffer->setFileName(fullpath);
|
||||
buffer->setDirty(false);
|
||||
buffer->setStatus(DOC_REGULAR);
|
||||
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
||||
|
@ -530,8 +536,11 @@ bool FileManager::loadFileData(Document doc, const char * filename, Utf8_16_Read
|
|||
return true;
|
||||
}
|
||||
BufferID FileManager::getBufferFromName(const char * name) {
|
||||
char fullpath[MAX_PATH];
|
||||
::GetFullPathName(name, MAX_PATH, fullpath, NULL);
|
||||
::GetLongPathName(fullpath, fullpath, MAX_PATH);
|
||||
for(size_t i = 0; i < _buffers.size(); i++) {
|
||||
if (!strcmp(name, _buffers.at(i)->getFilePath()))
|
||||
if (!strcmpi(name, _buffers.at(i)->getFilePath()))
|
||||
return _buffers.at(i)->getID();
|
||||
}
|
||||
return BUFFER_INVALID;
|
||||
|
|
|
@ -174,7 +174,7 @@ void LastRecentFileList::saveLRFL() {
|
|||
int LastRecentFileList::find(const char *fn) {
|
||||
int i = 0;
|
||||
for(int i = 0; i < _size; i++) {
|
||||
if (_lrfl.at(i)._name == fn) {
|
||||
if (!strcmpi(_lrfl.at(i)._name.c_str(), fn)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue