Skip to content

Commit

Permalink
Fix an omission in searchReplaceAll which can cause a hang when a reg…
Browse files Browse the repository at this point in the history
…ular expression replace all/before/after decreases the length of the document. Addresses Issue #16 .
  • Loading branch information
Coises committed Jan 4, 2024
1 parent 4464946 commit d906974
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Columns++ for Notepad++ -- Releases

## Version 1.0.2 -- January 4th, 2024

* **All users of versions 0.8 through 1.0.1 should update to this version as soon as possible.** This version fixes a serious bug in Search | Replace All/Before/After which can cause the entire application to hang (thus necessitating a force close of Notepad++ and loss of unsaved changes in all open tabs).

## Version 1.0.1 -- December 14th, 2023

* Added Width as an option for custom sorts; addresses Issue #15 feature request.
Expand Down
Binary file modified src/ColumnsPlusPlus.rc
Binary file not shown.
7 changes: 4 additions & 3 deletions src/Search.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is part of Columns++ for Notepad++.
// Copyright 2023 by Randall Joseph Fellmy <[email protected]>, <http://www.coises.com/software/>
// Copyright 2023, 2024 by Randall Joseph Fellmy <[email protected]>, <http://www.coises.com/software/>

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1030,8 +1030,9 @@ void ColumnsPlusPlusData::searchReplaceAll(bool partial, bool before) {
std::string r = rx.format(sciRepl.size() == 1 ? sciRepl[0] : calculateSubstitutions(*this, rx, found));
sci.SetTargetRange(found, found + length);
sci.ReplaceTarget(r);
cpFrom += r.length() - length;
cpTo += r.length() - length;
cpFrom += r.length() - length;
cpTo += r.length() - length;
partialEnd += r.length() - length;
sci.SetIndicatorCurrent(searchData.indicator);
sci.SetIndicatorValue(1);
sci.IndicatorFillRange(found, r.length());
Expand Down

0 comments on commit d906974

Please sign in to comment.