[BUG_FIXED] Fix empty line count failure (RE).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@724 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-12-11 19:43:37 +00:00
parent aedc097094
commit f2db20fc30
2 changed files with 14 additions and 9 deletions

View File

@ -1283,8 +1283,8 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
}
}
int start = posFind;//int((*_ppEditView)->execute(SCI_GETTARGETSTART));
int end = int((*_ppEditView)->execute(SCI_GETTARGETEND));
int start = posFind;
int end = int((*_ppEditView)->execute(SCI_GETTARGETEND));
// to make sure the found result is visible:
// prevent recording of absolute positioning commands issued in the process
@ -1458,7 +1458,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
int stringSizeFind = 0;
int stringSizeReplace = 0;
TCHAR *pTextFind = NULL;//new TCHAR[stringSizeFind + 1];
TCHAR *pTextFind = NULL;
if (!txt2find)
{
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
@ -1544,11 +1544,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
int replaceDelta = 0;
// Search resulted in empty token, possible with RE
/*
if (!foundTextLen) {
delete [] pTextFind;
delete [] pTextReplace;
return -1;
}
*/
switch (op)
{
@ -1660,12 +1662,14 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
}
startRange = targetStart + foundTextLen + replaceDelta; //search from result onwards
if (!foundTextLen && !replaceDelta)
startRange = targetStart + foundTextLen + 1; // find a empty string so just step forword
else
startRange = targetStart + foundTextLen + replaceDelta; //search from result onwards
endRange += replaceDelta; //adjust end of range in case of replace
nbProcessed++;
//::SendMessageA(_hParent, WM_SETTEXT, 0, (LPARAM)pTextFind);
targetStart = (*_ppEditView)->searchInTarget(pTextFind, stringSizeFind, startRange, endRange);
}
delete [] pTextFind;

View File

@ -95,7 +95,9 @@ RECT TaskList::adjustSize()
RECT rc;
ListView_GetItemRect(_hSelf, 0, &rc, LVIR_ICON);
const int imgWidth = rc.right - rc.left;
const int marge = 30;
const int leftMarge = 30;
const int xpBottomMarge = 5;
const int w7BottomMarge = 15;
// Temporary set "selected" font to get the worst case widths
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFontSelected), 0);
@ -113,14 +115,13 @@ RECT TaskList::adjustSize()
maxwidth = width;
_rc.bottom += rc.bottom - rc.top;
}
_rc.right = maxwidth + imgWidth + marge;
_rc.right = maxwidth + imgWidth + leftMarge;
ListView_SetColumnWidth(_hSelf, 0, _rc.right);
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), 0);
reSizeTo(_rc);
//_rc.right += marge;
winVer ver = (NppParameters::getInstance())->getWinVersion();
_rc.bottom += ver <= WV_XP?5:15;
_rc.bottom += ver <= WV_XP?xpBottomMarge:w7BottomMarge;
return _rc;
}