Skip to content

Commit

Permalink
[BUG_FIXED] Fix empty line count failure (RE).
Browse files Browse the repository at this point in the history
- Notepad-plus svn trunk @ 724
  • Loading branch information
donho committed Dec 11, 2010
1 parent 5e69c0b commit d6f2bb7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
14 changes: 9 additions & 5 deletions PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 5 additions & 4 deletions PowerEditor/src/WinControls/TaskList/TaskList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit d6f2bb7

Please sign in to comment.