mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 23:05:13 +02:00
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() ; )
|
for ( ; i < session.nbMainFiles() ; )
|
||||||
{
|
{
|
||||||
const char *pFn = session._mainViewFiles[i]._fileName.c_str();
|
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)) {
|
if (PathFileExists(pFn)) {
|
||||||
lastOpened = doOpen(pFn);
|
lastOpened = doOpen(pFn);
|
||||||
} else {
|
} else {
|
||||||
@ -512,6 +517,11 @@ bool Notepad_plus::loadSession(Session & session)
|
|||||||
for ( ; k < session.nbSubFiles() ; )
|
for ( ; k < session.nbSubFiles() ; )
|
||||||
{
|
{
|
||||||
const char *pFn = session._subViewFiles[k]._fileName.c_str();
|
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)) {
|
if (PathFileExists(pFn)) {
|
||||||
lastOpened = doOpen(pFn);
|
lastOpened = doOpen(pFn);
|
||||||
//check if already open in main. If so, clone
|
//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];
|
char longFileName[MAX_PATH];
|
||||||
::GetFullPathName(fileName, MAX_PATH, longFileName, NULL);
|
::GetFullPathName(fileName, MAX_PATH, longFileName, NULL);
|
||||||
|
::GetLongPathName(longFileName, longFileName, MAX_PATH);
|
||||||
|
|
||||||
_lastRecentFileList.remove(longFileName);
|
_lastRecentFileList.remove(longFileName);
|
||||||
|
|
||||||
@ -605,6 +616,11 @@ BufferID Notepad_plus::doOpen(const char *fileName, bool isReadOnly)
|
|||||||
}
|
}
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isFileSession(longFileName) && PathFileExists(longFileName)) {
|
||||||
|
fileLoadSession(longFileName);
|
||||||
|
return BUFFER_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
if (!PathFileExists(longFileName))
|
if (!PathFileExists(longFileName))
|
||||||
{
|
{
|
||||||
@ -882,14 +898,9 @@ void Notepad_plus::fileOpen()
|
|||||||
{
|
{
|
||||||
size_t sz = pfns->size();
|
size_t sz = pfns->size();
|
||||||
for (size_t i = 0 ; i < sz ; i++) {
|
for (size_t i = 0 ; i < sz ; i++) {
|
||||||
if (isFileSession(pfns->at(i).c_str())) {
|
BufferID test = doOpen(pfns->at(i).c_str(), fDlg.isReadOnly());
|
||||||
fileLoadSession(pfns->at(i).c_str());
|
if (test != BUFFER_INVALID)
|
||||||
lastOpened = BUFFER_INVALID;
|
lastOpened = test;
|
||||||
} else {
|
|
||||||
BufferID test = doOpen(pfns->at(i).c_str(), fDlg.isReadOnly());
|
|
||||||
if (test != BUFFER_INVALID)
|
|
||||||
lastOpened = test;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastOpened != BUFFER_INVALID) {
|
if (lastOpened != BUFFER_INVALID) {
|
||||||
@ -2768,10 +2779,10 @@ void Notepad_plus::command(int id)
|
|||||||
const int strSize = 64;
|
const int strSize = 64;
|
||||||
char str[strSize];
|
char str[strSize];
|
||||||
|
|
||||||
_incrementFindDlg.display();
|
|
||||||
|
|
||||||
_pEditView->getSelectedText(str, strSize);
|
_pEditView->getSelectedText(str, strSize);
|
||||||
_incrementFindDlg.setSearchText(str, _pEditView->getCurrentBuffer()->getUnicodeMode() != uni8Bit);
|
_incrementFindDlg.setSearchText(str, _pEditView->getCurrentBuffer()->getUnicodeMode() != uni8Bit);
|
||||||
|
|
||||||
|
_incrementFindDlg.display();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -367,9 +367,12 @@ BufferID FileManager::loadFile(const char * filename, Document doc) {
|
|||||||
doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT);
|
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
|
Utf8_16_Read UnicodeConvertor; //declare here so we can get information after loading is done
|
||||||
if (loadFileData(doc, filename, &UnicodeConvertor)) {
|
if (loadFileData(doc, fullpath, &UnicodeConvertor)) {
|
||||||
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_REGULAR, filename);
|
Buffer * newBuf = new Buffer(this, _nextBufferID, doc, DOC_REGULAR, fullpath);
|
||||||
BufferID id = (BufferID) newBuf;
|
BufferID id = (BufferID) newBuf;
|
||||||
newBuf->_id = id;
|
newBuf->_id = id;
|
||||||
_buffers.push_back(newBuf);
|
_buffers.push_back(newBuf);
|
||||||
@ -406,9 +409,12 @@ bool FileManager::saveBuffer(BufferID id, const char * filename, bool isCopy) {
|
|||||||
bool isSys = false;
|
bool isSys = false;
|
||||||
DWORD attrib;
|
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)
|
if (attrib != INVALID_FILE_ATTRIBUTES)
|
||||||
{
|
{
|
||||||
@ -429,7 +435,7 @@ bool FileManager::saveBuffer(BufferID id, const char * filename, bool isCopy) {
|
|||||||
Utf8_16_Write UnicodeConvertor;
|
Utf8_16_Write UnicodeConvertor;
|
||||||
UnicodeConvertor.setEncoding(mode);
|
UnicodeConvertor.setEncoding(mode);
|
||||||
|
|
||||||
FILE *fp = UnicodeConvertor.fopen(filename, "wb");
|
FILE *fp = UnicodeConvertor.fopen(fullpath, "wb");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, buffer->_doc); //generate new document
|
_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();
|
UnicodeConvertor.fclose();
|
||||||
|
|
||||||
if (isHidden)
|
if (isHidden)
|
||||||
::SetFileAttributes(filename, attrib | FILE_ATTRIBUTE_HIDDEN);
|
::SetFileAttributes(fullpath, attrib | FILE_ATTRIBUTE_HIDDEN);
|
||||||
|
|
||||||
if (isSys)
|
if (isSys)
|
||||||
::SetFileAttributes(filename, attrib | FILE_ATTRIBUTE_SYSTEM);
|
::SetFileAttributes(fullpath, attrib | FILE_ATTRIBUTE_SYSTEM);
|
||||||
|
|
||||||
if (isCopy) {
|
if (isCopy) {
|
||||||
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
|
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
|
||||||
return true; //all done
|
return true; //all done
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->setFileName(filename);
|
buffer->setFileName(fullpath);
|
||||||
buffer->setDirty(false);
|
buffer->setDirty(false);
|
||||||
buffer->setStatus(DOC_REGULAR);
|
buffer->setStatus(DOC_REGULAR);
|
||||||
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
||||||
@ -530,8 +536,11 @@ bool FileManager::loadFileData(Document doc, const char * filename, Utf8_16_Read
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
BufferID FileManager::getBufferFromName(const char * name) {
|
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++) {
|
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 _buffers.at(i)->getID();
|
||||||
}
|
}
|
||||||
return BUFFER_INVALID;
|
return BUFFER_INVALID;
|
||||||
|
@ -174,7 +174,7 @@ void LastRecentFileList::saveLRFL() {
|
|||||||
int LastRecentFileList::find(const char *fn) {
|
int LastRecentFileList::find(const char *fn) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(int i = 0; i < _size; i++) {
|
for(int i = 0; i < _size; i++) {
|
||||||
if (_lrfl.at(i)._name == fn) {
|
if (!strcmpi(_lrfl.at(i)._name.c_str(), fn)) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user