ide: Fixed freeze on empty block replace

git-svn-id: svn://ultimatepp.org/upp/trunk@15563 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-12-02 09:08:46 +00:00
parent 5895e90a99
commit c5bab37f6c

View file

@ -550,13 +550,15 @@ int CodeEditor::BlockReplace()
foundpos = l;
Index<int> ln;
StartSearchProgress(l, h);
while(FindFrom(foundpos, false, true) && foundpos + foundsize <= h) {
while(foundpos < GetLength() && FindFrom(foundpos, false, true) && foundpos + foundsize <= h) {
CachePos(foundpos);
if(~findreplace.mode == 0) {
Remove((int)foundpos, foundsize);
WString rt = GetReplaceText();
Insert((int)foundpos, rt);
foundpos += rt.GetCount();
if(foundsize + rt.GetCount() == 0 && foundpos < GetLength())
foundpos++;
h = h - foundsize + rt.GetCount();
count++;
}