[BUG_FIXED] Fix file association Unicode bug.

[BUG_FIXED] Fix WindowDlg close file bug.
[BUG_FIXED] Add html.xml, sql.xml and rc.xml into installer.
[CHANGE] Change the reload from disk behaviour.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@337 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-10-05 20:20:17 +00:00
parent 22f25219e2
commit af23902b82
11 changed files with 168 additions and 127 deletions

View File

@ -2,16 +2,33 @@ Notepad++ v5.1 fixed bugs and added features (from v5.0.3) :
1. Make Notepad++ Unicode-compliant application(Unicode path supported).
2. Fix crash issue due to the incoherent modification/creation date.
3. Fix tag match highlighting mismatched bug.
4. Make tag match highlighting on non html zone optional.
5. Refine the Save/Open file directory settings (follow tab/last operation/user defined dir).
6. Add "Doc go to new instance" and "Doc open in new instance" features.
7. Add new pluin notification NPPN_DOCACTIVATED and NPPN_LANGCHANGED.
8. Fix context menu incorrect setting crash bug.
9. Fix a problem with Incremental search+UTF8 in win9x.
10. Fix bug with CPP lexer keyword list.
3. Enhance Find in files feature : launch in thread, stop as wish.
4. Fix tag match highlighting mismatched bug.
5. Make tag match highlighting on non html zone optional.
6. Fix cpu high consumption bug while document is cloned with smart highlighting and xml matched highlighting features activating.
7. Refine the Save/Open file directory settings (follow tab/last operation/user defined dir).
8. Add "Doc go to new instance" and "Doc open in new instance" features.
9. Move document to another instance of Notepad++ via drag and drop document tab.
10. Add new pluin notification NPPN_DOCACTIVATED and NPPN_LANGCHANGED.
11. Fix context menu incorrect setting crash bug.
12. Fix crash problem while typing Chinese character in ANSI CSS document under Chinese environment.
13. Fix a problem with Incremental search+UTF8 in win9x.
14. Fix the User defined language not working in Unicode version bug.
15. Fix bug with CPP lexer keyword list.
16. Fix auto-completion not woring for HTML, SQL and RC problem.
17. Remove all the comic sans font (finally :) ).
Included plugins (Unicode):
1. TexFX v0.24a
2. MIME Tools v1.5
3. NppExport v0.2.8
4. Doc Monitor v2.2
5. NppAutoIndent 1.2
6. FTP_synchronize v0.9.6
7. NppAutoIndent 1.2
Included plugins (ANSI):
1. TexFX v0.24a
@ -24,10 +41,3 @@ Included plugins (ANSI):
8. Light Explorer v1.5
9. Doc Monitor v2.2
10. NppAutoIndent 1.2
Included plugins (Unicode):
1. MIME Tools v1.5
2. NppExport v0.2.8
3. Doc Monitor v2.2
4. NppAutoIndent 1.2
5. FTP_synchronize v0.9.6

View File

@ -571,6 +571,16 @@ SubSection "Auto-completion Files" autoCompletionComponent
File "..\bin\plugins\APIs\html.xml"
SectionEnd
Section RC
SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\rc.xml"
SectionEnd
Section SQL
SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\sql.xml"
SectionEnd
Section PHP
SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\php.xml"
@ -814,6 +824,21 @@ SubSection un.autoCompletionComponent
Section un.CSS
Delete "$INSTDIR\plugins\APIs\css.xml"
RMDir "$INSTDIR\plugins\APIs\"
SectionEnd
Section un.HTML
Delete "$INSTDIR\plugins\APIs\html.xml"
RMDir "$INSTDIR\plugins\APIs\"
SectionEnd
Section un.SQL
Delete "$INSTDIR\plugins\APIs\sql.xml"
RMDir "$INSTDIR\plugins\APIs\"
SectionEnd
Section un.RC
Delete "$INSTDIR\plugins\APIs\rc.xml"
RMDir "$INSTDIR\plugins\APIs\"
SectionEnd
Section un.VB

View File

@ -230,7 +230,7 @@ void RegExtDlg::getRegisteredExts()
{
//TCHAR valName[extNameLen];
TCHAR valData[extNameLen];
int valDataLen = extNameLen;
int valDataLen = extNameLen * sizeof(TCHAR);
int valType;
HKEY hKey2Check;
extNameActualLen = extNameLen;
@ -269,17 +269,16 @@ void RegExtDlg::addExt(TCHAR *ext)
if (nRet == ERROR_SUCCESS)
{
int valDataLen = 256;
TCHAR valData[256];
TCHAR valData[MAX_PATH];
int valDataLen = MAX_PATH * sizeof(TCHAR);
if (dwDisp == REG_OPENED_EXISTING_KEY)
{
int res = ::RegQueryValueEx(hKey, TEXT(""), NULL, NULL, (LPBYTE)valData, (LPDWORD)&valDataLen);
if (res == ERROR_SUCCESS)
::RegSetValueEx(hKey, nppBackup, 0, REG_SZ, (LPBYTE)valData, valDataLen+1);
::RegSetValueEx(hKey, nppBackup, 0, REG_SZ, (LPBYTE)valData, valDataLen);
}
::RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)nppName, lstrlen(nppName)+1);
::RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)nppName, (lstrlen(nppName)+1)*sizeof(TCHAR));
::RegCloseKey(hKey);
}
@ -302,7 +301,7 @@ bool RegExtDlg::deleteExts(const TCHAR *ext2Delete)
else
{
TCHAR valData[extNameLen];
int valDataLen = extNameLen;
int valDataLen = extNameLen*sizeof(TCHAR);
int valType;
int res = ::RegQueryValueEx(hKey, nppBackup, NULL, (LPDWORD)&valType, (LPBYTE)valData, (LPDWORD)&valDataLen);
@ -344,7 +343,7 @@ void RegExtDlg::writeNppPath()
{
// Write the value for new document
::RegOpenKeyEx(HKEY_CLASSES_ROOT, nppName, 0, KEY_ALL_ACCESS, &hRootKey);
::RegSetValueEx(hRootKey, NULL, 0, REG_SZ, (LPBYTE)nppDoc, lstrlen(nppDoc)+1);
::RegSetValueEx(hRootKey, NULL, 0, REG_SZ, (LPBYTE)nppDoc, (lstrlen(nppDoc)+1)*sizeof(TCHAR));
TCHAR nppPath[MAX_PATH];
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
@ -352,7 +351,7 @@ void RegExtDlg::writeNppPath()
TCHAR nppPathParam[256] = TEXT("\"");
lstrcat(lstrcat(nppPathParam, nppPath), TEXT("\" \"%1\""));
::RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)nppPathParam, lstrlen(nppPathParam)+1);
::RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
}
RegCloseKey(hKey);
}

View File

@ -722,7 +722,7 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
*/
if (alert)
{
if (::MessageBox(_hSelf, TEXT("Do you want to reload the current file?"), TEXT("Reload"), MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL) != IDYES)
if (::MessageBox(_hSelf, TEXT("Are you sure you want to reload the current file and lose the changes made in Notepad++?"), TEXT("Reload"), MB_YESNO | MB_ICONEXCLAMATION | MB_APPLMODAL) != IDYES)
return false;
}
@ -793,9 +793,9 @@ void Notepad_plus::doClose(BufferID id, int whichOne) {
_pluginsManager.notify(&scnN);
//add to recent files if its an existing file
if (!buf->isUntitled() && PathFileExists(buf->getFilePath()))
if (!buf->isUntitled() && PathFileExists(buf->getFullPathName()))
{
_lastRecentFileList.add(buf->getFilePath());
_lastRecentFileList.add(buf->getFullPathName());
}
int nrDocs = whichOne==MAIN_VIEW?(_mainDocTab.nbItem()):(_subDocTab.nbItem());
@ -823,7 +823,7 @@ void Notepad_plus::fileNew()
bool Notepad_plus::fileReload()
{
BufferID buf = _pEditView->getCurrentBufferID();
return doReload(buf, true);
return doReload(buf, buf->isDirty());
}
generic_string exts2Filters(generic_string exts) {
@ -985,7 +985,7 @@ bool Notepad_plus::fileSave(BufferID id)
if (!buf->getFileReadOnly() && buf->isDirty()) //cannot save if readonly
{
const TCHAR *fn = buf->getFilePath();
const TCHAR *fn = buf->getFullPathName();
if (buf->isUntitled())
{
return fileSaveAs(id);
@ -1062,7 +1062,7 @@ bool Notepad_plus::fileSave(BufferID id)
::CopyFile(fn, fn_dateTime_bak.c_str(), FALSE);
}
return doSave(bufferID, buf->getFilePath(), false);
return doSave(bufferID, buf->getFullPathName(), false);
}
}
return false;
@ -1152,7 +1152,7 @@ bool Notepad_plus::fileDelete(BufferID id, int curView)
bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager->getBufferByID(bufferID);
const TCHAR *fileNamePath = buf->getFilePath();
const TCHAR *fileNamePath = buf->getFullPathName();
if (PathFileExists(fileNamePath))
return false;
@ -1174,7 +1174,7 @@ bool Notepad_plus::fileDelete(BufferID id, int curView)
bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager->getBufferByID(bufferID);
const TCHAR *fileNamePath = buf->getFilePath();
const TCHAR *fileNamePath = buf->getFullPathName();
if (doDeleteOrNot(fileNamePath) == IDYES)
{
@ -1200,7 +1200,7 @@ bool Notepad_plus::fileClose(BufferID id, int curView)
int res;
//process the fileNamePath into LRF
const TCHAR *fileNamePath = buf->getFilePath();
const TCHAR *fileNamePath = buf->getFullPathName();
if (buf->isDirty())
{
@ -1242,7 +1242,7 @@ bool Notepad_plus::fileCloseAll()
BufferID id = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id);
if (buf->isDirty()) {
int res = doSaveOrNot(buf->getFilePath());
int res = doSaveOrNot(buf->getFullPathName());
if (res == IDYES) {
if (!fileSave(id))
return false; //abort entire procedure
@ -1256,7 +1256,7 @@ bool Notepad_plus::fileCloseAll()
BufferID id = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id);
if (buf->isDirty()) {
int res = doSaveOrNot(buf->getFilePath());
int res = doSaveOrNot(buf->getFullPathName());
if (res == IDYES) {
if (!fileSave(id))
return false; //abort entire procedure
@ -1298,7 +1298,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
continue;
Buffer * buf = MainFileManager->getBufferByID(id);
if (buf->isDirty()) {
int res = doSaveOrNot(buf->getFilePath());
int res = doSaveOrNot(buf->getFullPathName());
if (res == IDYES) {
if (!fileSave(id))
return false; //abort entire procedure
@ -1314,7 +1314,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
if (id == current)
continue;
if (buf->isDirty()) {
int res = doSaveOrNot(buf->getFilePath());
int res = doSaveOrNot(buf->getFullPathName());
if (res == IDYES) {
if (!fileSave(id))
return false; //abort entire procedure
@ -1635,7 +1635,7 @@ bool Notepad_plus::findInOpenedFiles() {
{
pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFilePath());
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
}
}
@ -1645,7 +1645,7 @@ bool Notepad_plus::findInOpenedFiles() {
{
pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFilePath());
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
}
}
@ -1701,7 +1701,7 @@ void Notepad_plus::checkDocState()
bool isCurrentDirty = curBuf->isDirty();
bool isSeveralDirty = isCurrentDirty;
bool isFileExisting = PathFileExists(curBuf->getFilePath()) != FALSE;
bool isFileExisting = PathFileExists(curBuf->getFullPathName()) != FALSE;
if (!isCurrentDirty)
{
for(int i = 0; i < MainFileManager->getNrBuffers(); i++)
@ -1977,7 +1977,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
else
{
generic_string quotFileName = TEXT("\"");
quotFileName += _pEditView->getCurrentBuffer()->getFilePath();
quotFileName += _pEditView->getCurrentBuffer()->getFullPathName();
quotFileName += TEXT("\"");
COPYDATASTRUCT fileNamesData;
fileNamesData.dwData = COPYDATA_FILENAMES;
@ -1995,7 +1995,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW;
if (buf->isDirty())
{
::MessageBox(_hSelf, TEXT("Buffer can not be dirty"), TEXT(""), MB_OK);
::MessageBox(_hSelf, TEXT("Document is modified, save it then try again."), TEXT("Go to another Notepad++ instance"), MB_OK);
}
else
{
@ -2339,7 +2339,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_tabPopupMenu.enableItem(IDM_EDIT_SETREADONLY, !isSysReadOnly);
_tabPopupMenu.enableItem(IDM_EDIT_CLEARREADONLY, isSysReadOnly);
bool isFileExisting = PathFileExists(buf->getFilePath()) != FALSE;
bool isFileExisting = PathFileExists(buf->getFullPathName()) != FALSE;
_tabPopupMenu.enableItem(IDM_FILE_DELETE, isFileExisting);
_tabPopupMenu.enableItem(IDM_FILE_RENAME, isFileExisting);
@ -2450,13 +2450,13 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
BufferID idd = _mainDocTab.getBufferByIndex(id);
Buffer * buf = MainFileManager->getBufferByID(idd);
tip = buf->getFilePath();
tip = buf->getFullPathName();
}
else if (hWin == _subDocTab.getHSelf())
{
BufferID idd = _subDocTab.getBufferByIndex(id);
Buffer * buf = MainFileManager->getBufferByID(idd);
tip = buf->getFilePath();
tip = buf->getFullPathName();
}
else
break;
@ -3072,10 +3072,10 @@ void Notepad_plus::command(int id)
{
Buffer * buf = _pEditView->getCurrentBuffer();
if (id == IDM_EDIT_FULLPATHTOCLIP) {
str2Cliboard(buf->getFilePath());
str2Cliboard(buf->getFullPathName());
} else if (id == IDM_EDIT_CURRENTDIRTOCLIP) {
TCHAR dir[MAX_PATH];
lstrcpy(dir, buf->getFilePath());
lstrcpy(dir, buf->getFullPathName());
PathRemoveFileSpec((TCHAR *)dir);
str2Cliboard(dir);
} else if (id == IDM_EDIT_FILENAMETOCLIP) {
@ -4548,7 +4548,7 @@ void Notepad_plus::setTitle()
if (buf->isDirty()) {
result += TEXT("*");
}
result += buf->getFilePath();
result += buf->getFullPathName();
result += TEXT(" - ");
result += _className;
::SetWindowText(_hSelf, result.c_str());
@ -6204,14 +6204,14 @@ void Notepad_plus::getTaskListInfo(TaskListInfo *tli)
BufferID bufID = _pDocTab->getBufferByIndex(i);
Buffer * b = MainFileManager->getBufferByID(bufID);
int status = b->isReadOnly()?tb_ro:(b->isDirty()?tb_unsaved:tb_saved);
tli->_tlfsLst.push_back(TaskLstFnStatus(currentView(), i, b->getFilePath(), status));
tli->_tlfsLst.push_back(TaskLstFnStatus(currentView(), i, b->getFullPathName(), status));
}
for (size_t i = 0 ; i < nonCurrentNbDoc ; i++)
{
BufferID bufID = _pNonDocTab->getBufferByIndex(i);
Buffer * b = MainFileManager->getBufferByID(bufID);
int status = b->isReadOnly()?tb_ro:(b->isDirty()?tb_unsaved:tb_saved);
tli->_tlfsLst.push_back(TaskLstFnStatus(otherView(), i, b->getFilePath(), status));
tli->_tlfsLst.push_back(TaskLstFnStatus(otherView(), i, b->getFullPathName(), status));
}
}
@ -6983,7 +6983,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{
TCHAR str[MAX_PATH];
// par defaut : NPPM_GETCURRENTDIRECTORY
TCHAR *fileStr = lstrcpy(str, _pEditView->getCurrentBuffer()->getFilePath());
TCHAR *fileStr = lstrcpy(str, _pEditView->getCurrentBuffer()->getFullPathName());
if (Message == NPPM_GETCURRENTDIRECTORY)
PathRemoveFileSpec(str);
@ -7116,7 +7116,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{
BufferID id = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id);
lstrcpy(fileNames[j++], buf->getFilePath());
lstrcpy(fileNames[j++], buf->getFullPathName());
}
}
if (Message != NPPM_GETOPENFILENAMESPRIMARY) {
@ -7124,7 +7124,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{
BufferID id = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id);
lstrcpy(fileNames[j++], buf->getFilePath());
lstrcpy(fileNames[j++], buf->getFullPathName());
}
}
return j;
@ -8100,11 +8100,11 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
NMWINDLG* nmdlg = (NMWINDLG*)lParam;
switch (nmdlg->type)
{
case WDT_ACTIVATE:
activateDoc(nmdlg->curSel);
nmdlg->processed = TRUE;
break;
case WDT_SAVE:
case WDT_ACTIVATE:
activateDoc(nmdlg->curSel);
nmdlg->processed = TRUE;
break;
case WDT_SAVE:
{
//loop through nmdlg->nItems, get index and save it
for (int i = 0; i < (int)nmdlg->nItems; i++) {
@ -8113,13 +8113,14 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
nmdlg->processed = TRUE;
}
break;
case WDT_CLOSE:
case WDT_CLOSE:
{
//loop through nmdlg->nItems, get index and close it
for (int i = 0; i < (int)nmdlg->nItems; i++) {
fileClose(_pDocTab->getBufferByIndex(i), currentView());
nmdlg->Items[i] = 0xFFFFFFFF; // indicate file was closed
fileClose(_pDocTab->getBufferByIndex(nmdlg->Items[i]), currentView());
UINT pos = nmdlg->Items[i];
nmdlg->Items[i] = 0xFFFFFFFF; // indicate file was closed
for (int j=i+1; j<(int)nmdlg->nItems; ++j)
if (nmdlg->Items[j] > pos)
--nmdlg->Items[j];
@ -8127,20 +8128,20 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
nmdlg->processed = TRUE;
}
break;
case WDT_SORT:
if (nmdlg->nItems != _pDocTab->nbItem()) //sanity check, if mismatch just abort
case WDT_SORT:
if (nmdlg->nItems != _pDocTab->nbItem()) //sanity check, if mismatch just abort
break;
//Collect all buffers
std::vector<BufferID> tempBufs;
for(int i = 0; i < (int)nmdlg->nItems; i++) {
tempBufs.push_back(_pDocTab->getBufferByIndex(i));
}
//Reset buffers
for(int i = 0; i < (int)nmdlg->nItems; i++) {
_pDocTab->setBuffer(i, tempBufs[nmdlg->Items[i]]);
}
activateBuffer(_pDocTab->getBufferByIndex(_pDocTab->getCurrentTabIndex()), currentView());
break;
//Collect all buffers
std::vector<BufferID> tempBufs;
for(int i = 0; i < (int)nmdlg->nItems; i++) {
tempBufs.push_back(_pDocTab->getBufferByIndex(i));
}
//Reset buffers
for(int i = 0; i < (int)nmdlg->nItems; i++) {
_pDocTab->setBuffer(i, tempBufs[nmdlg->Items[i]]);
}
activateBuffer(_pDocTab->getBufferByIndex(_pDocTab->getCurrentTabIndex()), currentView());
break;
}
return TRUE;
}
@ -8179,8 +8180,6 @@ LRESULT CALLBACK Notepad_plus::Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM
void Notepad_plus::fullScreenToggle()
{
HMONITOR currentMonitor; //Handle to monitor where fullscreen should go
MONITORINFO mi; //Info of that monitor
RECT fullscreenArea; //RECT used to calculate window fullscrene size
_isfullScreen = !_isfullScreen;
@ -8194,17 +8193,21 @@ void Notepad_plus::fullScreenToggle()
fullscreenArea.left = 0;
fullscreenArea.right = GetSystemMetrics(SM_CXSCREEN);
fullscreenArea.bottom = GetSystemMetrics(SM_CYSCREEN);
//Caution, this will not work on windows 95, so probably add some checking of some sorts like Unicode checks, IF 95 were to be supported
currentMonitor = MonitorFromWindow(_hSelf, MONITOR_DEFAULTTONEAREST); //should always be valid monitor handle
mi.cbSize = sizeof(MONITORINFO);
if (GetMonitorInfo(currentMonitor, &mi) != FALSE)
//if (_winVersion != WV_NT)
{
fullscreenArea = mi.rcMonitor;
fullscreenArea.right -= fullscreenArea.left;
fullscreenArea.bottom -= fullscreenArea.top;
HMONITOR currentMonitor; //Handle to monitor where fullscreen should go
MONITORINFO mi; //Info of that monitor
//Caution, this will not work on windows 95, so probably add some checking of some sorts like Unicode checks, IF 95 were to be supported
currentMonitor = MonitorFromWindow(_hSelf, MONITOR_DEFAULTTONEAREST); //should always be valid monitor handle
mi.cbSize = sizeof(MONITORINFO);
if (GetMonitorInfo(currentMonitor, &mi) != FALSE)
{
fullscreenArea = mi.rcMonitor;
fullscreenArea.right -= fullscreenArea.left;
fullscreenArea.bottom -= fullscreenArea.top;
}
}
//Hide menu
::SetMenu(_hSelf, NULL);
@ -8375,12 +8378,12 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
{
BufferID bufID = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(bufID);
if (!buf->isUntitled() && PathFileExists(buf->getFilePath()))
if (!buf->isUntitled() && PathFileExists(buf->getFullPathName()))
{
generic_string languageName = getLangFromMenu( buf );
const TCHAR *langName = languageName.c_str();
sessionFileInfo sfi(buf->getFilePath(), langName, buf->getPosition(&_mainEditView));
sessionFileInfo sfi(buf->getFullPathName(), langName, buf->getPosition(&_mainEditView));
//_mainEditView.activateBuffer(buf->getID());
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
@ -8400,12 +8403,12 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
{
BufferID bufID = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(bufID);
if (!buf->isUntitled() && PathFileExists(buf->getFilePath()))
if (!buf->isUntitled() && PathFileExists(buf->getFullPathName()))
{
generic_string languageName = getLangFromMenu( buf );
const TCHAR *langName = languageName.c_str();
sessionFileInfo sfi(buf->getFilePath(), langName, buf->getPosition(&_subEditView));
sessionFileInfo sfi(buf->getFullPathName(), langName, buf->getPosition(&_subEditView));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT);
@ -8659,10 +8662,10 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
case DOC_MODIFIED: //ask for reloading
{
bool autoUpdate = (nppGUI._fileAutoDetection == cdAutoUpdate) || (nppGUI._fileAutoDetection == cdAutoUpdateGo2end);
if (!autoUpdate)
if (!autoUpdate || buffer->isDirty())
{
didDialog = true;
if (doReloadOrNot(buffer->getFilePath()) != IDYES)
if (doReloadOrNot(buffer->getFullPathName(), buffer->isDirty()) != IDYES)
break; //abort
}
//activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
@ -8681,7 +8684,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
iView = otherView();
//activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
didDialog = true;
if (doCloseOrNot(buffer->getFilePath()) == IDNO)
if (doCloseOrNot(buffer->getFullPathName()) == IDNO)
{
//close in both views, doing current view last since that has to remain opened
doClose(buffer->getID(), otherView());
@ -8723,7 +8726,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
checkDocState();
setTitle();
TCHAR dir[MAX_PATH];
lstrcpy(dir, buffer->getFilePath());
lstrcpy(dir, buffer->getFullPathName());
PathRemoveFileSpec(dir);
setWorkingDir(dir);
}
@ -8777,7 +8780,7 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) {
setDisplayFormat(buf->getFormat());
enableConvertMenuItems(buf->getFormat());
TCHAR dir[MAX_PATH];
lstrcpy(dir, buf->getFilePath());
lstrcpy(dir, buf->getFullPathName());
PathRemoveFileSpec(dir);
setWorkingDir(dir);
setTitle();

View File

@ -394,11 +394,13 @@ private:
return doActionOrNot(TEXT("Save"), phrase, MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
};
int doReloadOrNot(const TCHAR *fn) {
TCHAR pattern[128] = TEXT("The file \"%s\" is modified by another program.\rReload this file?");
int doReloadOrNot(const TCHAR *fn, bool dirty) {
TCHAR* pattern = TEXT("%s\r\rThis file has been modified by another program.\rDo you want to reload it%s?");
TCHAR* lose_info_str = dirty ? TEXT(" and lose the changes made in Notepad++") : TEXT("");
TCHAR phrase[512];
wsprintf(phrase, pattern, fn);
return doActionOrNot(TEXT("Reload"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL);
wsprintf(phrase, pattern, fn, lose_info_str);
int icon = dirty ? MB_ICONEXCLAMATION : MB_ICONQUESTION;
return doActionOrNot(TEXT("Reload"), phrase, MB_YESNO | MB_APPLMODAL | icon);
};
int doCloseOrNot(const TCHAR *fn) {

View File

@ -423,7 +423,7 @@ bool FileManager::reloadBuffer(BufferID id) {
Document doc = buf->getDocument();
Utf8_16_Read UnicodeConvertor;
buf->_canNotify = false; //disable notify during file load, we dont want dirty to be triggered
bool res = loadFileData(doc, buf->getFilePath(), &UnicodeConvertor, buf->getLangType());
bool res = loadFileData(doc, buf->getFullPathName(), &UnicodeConvertor, buf->getLangType());
buf->_canNotify = true;
if (res) {
if (UnicodeConvertor.getNewBuf()) {
@ -446,7 +446,7 @@ bool FileManager::reloadBufferDeferred(BufferID id) {
bool FileManager::deleteFile(BufferID id)
{
Buffer * buf = getBufferByID(id);
const TCHAR *fileNamePath = buf->getFilePath();
const TCHAR *fileNamePath = buf->getFullPathName();
if (!PathFileExists(fileNamePath))
return false;
return ::DeleteFile(fileNamePath) != 0;
@ -455,7 +455,7 @@ bool FileManager::deleteFile(BufferID id)
bool FileManager::moveFile(BufferID id, const TCHAR * newFileName)
{
Buffer * buf = getBufferByID(id);
const TCHAR *fileNamePath = buf->getFilePath();
const TCHAR *fileNamePath = buf->getFullPathName();
if (!PathFileExists(fileNamePath))
return false;
@ -622,7 +622,7 @@ BufferID FileManager::getBufferFromName(const TCHAR * name) {
::GetFullPathName(name, MAX_PATH, fullpath, NULL);
::GetLongPathName(fullpath, fullpath, MAX_PATH);
for(size_t i = 0; i < _buffers.size(); i++) {
if (!lstrcmpi(name, _buffers.at(i)->getFilePath()))
if (!lstrcmpi(name, _buffers.at(i)->getFullPathName()))
return _buffers.at(i)->getID();
}
return BUFFER_INVALID;
@ -649,6 +649,6 @@ int FileManager::getFileNameFromBuffer(BufferID id, TCHAR * fn2copy) {
return -1;
Buffer * buf = getBufferByID(id);
if (fn2copy)
lstrcpy(fn2copy, buf->getFilePath());
return lstrlen(buf->getFilePath());
}
lstrcpy(fn2copy, buf->getFullPathName());
return lstrlen(buf->getFullPathName());
}

View File

@ -160,7 +160,7 @@ public :
// 3. gets the last modified time
void setFileName(const TCHAR *fn, LangType defaultLang = L_TXT);
const TCHAR * getFilePath() const {
const TCHAR * getFullPathName() const {
return _fullPathName;
};

View File

@ -75,7 +75,7 @@ BufferID DocTabView::findBufferByName(const TCHAR * fullfilename) { //-1 if not
::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie));
BufferID id = (BufferID)tie.lParam;
Buffer * buf = MainFileManager->getBufferByID(id);
if (!lstrcmp(fullfilename, buf->getFilePath())) {
if (!lstrcmp(fullfilename, buf->getFullPathName())) {
return id;
}
}

View File

@ -178,7 +178,7 @@ size_t Printer::doPrint(bool justDoIt)
DOCINFO docInfo;
docInfo.cbSize = sizeof(DOCINFO);
docInfo.lpszDocName = _pSEView->getCurrentBuffer()->getFilePath();
docInfo.lpszDocName = _pSEView->getCurrentBuffer()->getFullPathName();
docInfo.lpszOutput = NULL;
if (::StartDoc(_pdlg.hDC, &docInfo) < 0)

View File

@ -118,8 +118,8 @@ struct BufferEquivalent
}
else if (_iColumn == 1)
{
const TCHAR *s1 = b1->getFilePath();
const TCHAR *s2 = b2->getFilePath();
const TCHAR *s1 = b1->getFullPathName();
const TCHAR *s2 = b2->getFullPathName();
return _strequiv(s1, s2); //we can compare the full path to sort on directory, since after sorting directories sorting files is the second thing to do (if directories are the same that is)
}
else if (_iColumn == 2)
@ -270,7 +270,7 @@ BOOL CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
}
else if (pLvdi->item.iSubItem == 1) // directory
{
const TCHAR *fullName = buf->getFilePath();
const TCHAR *fullName = buf->getFullPathName();
const TCHAR *fileName = buf->getFileName();
int len = lstrlen(fullName)-lstrlen(fileName);
if (!len) {
@ -656,6 +656,7 @@ void WindowsDlg::doClose()
for(UINT i=-1, j=0;; ++j) {
i = ListView_GetNextItem(_hList, i, LVNI_SELECTED);
if (i == -1) break;
ListView_SetItemState(_hList, i, 0, LVIS_SELECTED); // deselect
nmdlg.Items[j] = _idxMap[i];
key[j] = i;
}
@ -683,7 +684,13 @@ void WindowsDlg::doClose()
doRefresh(true);
else
{
ListView_RedrawItems(_hList, 0, ListView_GetSelectedCount(_hList));
// select first previously selected item (or last one if only the last one was removed)
if (index == _idxMap.size()) index --;
if (index >= 0)
{
ListView_SetItemState(_hList, index, LVIS_SELECTED, LVIS_SELECTED);
ListView_RedrawItems(_hList, 0, _idxMap.size() - 1);
}
ListView_SetItemCount(_hList, _idxMap.size());
}
}

View File

@ -1,9 +1,9 @@
// Scintilla source code edit control
/** @file LexCSS.cxx
** Lexer for Cascading Style Sheets
** Written by Jakub Vrána
** Improved by Philippe Lhoste (CSS2)
**/
** Lexer for Cascading Style Sheets
** Written by Jakub Vr?na
** Improved by Philippe Lhoste (CSS2)
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@ -31,8 +31,8 @@ static inline bool IsAWordChar(const unsigned int ch) {
return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character
}
inline bool IsCssOperator(const char ch) {
if (!isalnum(ch) &&
inline bool IsCssOperator(const int ch) {
if (!((ch < 0x80) && isalnum(ch)) &&
(ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' ||
ch == '.' || ch == '#' || ch == '!' || ch == '@' ||
/* CSS2 */
@ -194,19 +194,14 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
s2++;
switch (sc.state) {
case SCE_CSS_IDENTIFIER:
if (!keywords.InList(s2)) {
if (keywords2.InList(s2)) {
sc.ChangeState(SCE_CSS_IDENTIFIER2);
} else {
sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER);
}
}
break;
case SCE_CSS_IDENTIFIER2:
case SCE_CSS_UNKNOWN_IDENTIFIER:
if (keywords.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER);
else if (keywords2.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER2);
else
sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER);
break;
case SCE_CSS_PSEUDOCLASS:
if (!pseudoClasses.InList(s2))
@ -232,7 +227,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.Forward();
} else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) {
sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING));
} else if (IsCssOperator(static_cast<char>(sc.ch))
} else if (IsCssOperator(sc.ch)
&& (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']')
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
&& (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{')