mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-20 20:34:41 +02:00
[BUG_FIXED] Fix file ext unexpected behaviour.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@546 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
d36fd964e4
commit
2478059b5d
@ -261,6 +261,7 @@ static HWND hFileDlg = NULL;
|
||||
static WNDPROC oldProc = NULL;
|
||||
static generic_string currentExt = TEXT("");
|
||||
|
||||
|
||||
static BOOL CALLBACK fileDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
switch (message)
|
||||
{
|
||||
@ -278,7 +279,7 @@ static BOOL CALLBACK fileDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
|
||||
if (currentExt != TEXT(""))
|
||||
{
|
||||
generic_string fnExt = changeExt(fn, currentExt);
|
||||
generic_string fnExt = changeExt(fn, currentExt, false);
|
||||
::SetWindowText(fnControl, fnExt.c_str());
|
||||
}
|
||||
return oldProc(hwnd, message, wParam, lParam);
|
||||
@ -292,6 +293,7 @@ static BOOL CALLBACK fileDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
return oldProc(hwnd, message, wParam, lParam);
|
||||
};
|
||||
|
||||
|
||||
static TCHAR * get1stExt(TCHAR *ext) { // precondition : ext should be under the format : Batch (*.bat;*.cmd;*.nt)
|
||||
TCHAR *begin = ext;
|
||||
for ( ; *begin != '.' ; begin++);
|
||||
@ -441,7 +443,7 @@ void goToCenter(HWND hwnd)
|
||||
::SetWindowPos(hwnd, HWND_TOP, x, y, _rc.right - _rc.left, _rc.bottom - _rc.top, SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
generic_string changeExt(generic_string fn, generic_string ext)
|
||||
generic_string changeExt(generic_string fn, generic_string ext, bool forceReplaced)
|
||||
{
|
||||
if (ext == TEXT(""))
|
||||
return fn;
|
||||
@ -455,7 +457,7 @@ generic_string changeExt(generic_string fn, generic_string ext)
|
||||
{
|
||||
fnExt += extension;
|
||||
}
|
||||
else
|
||||
else if (forceReplaced)
|
||||
{
|
||||
int len = (extension.length() > fnExt.length() - index + 1)?extension.length():fnExt.length() - index + 1;
|
||||
fnExt.replace(index, len, extension);
|
||||
|
@ -52,7 +52,7 @@ struct OPENFILENAMENPP {
|
||||
};
|
||||
|
||||
|
||||
generic_string changeExt(generic_string fn, generic_string ext);
|
||||
generic_string changeExt(generic_string fn, generic_string ext, bool forceReplaced = true);
|
||||
void goToCenter(HWND hwnd);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user