Skip to content

Commit

Permalink
When the user attempts to initiate a search with a multiple selection…
Browse files Browse the repository at this point in the history
… in which all selections are empty, show a message that a search region could not be constructed from the selection. Previous behavior was to become unresponsive, requiring the user to force-close Notepad++. Addresses issue #13.
  • Loading branch information
Coises committed Oct 17, 2023
1 parent b3491c1 commit 0fb1898
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
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++ -- Pre-releases

## Version 0.7.5-alpha -- October 17th, 2023

* When the user attempts to initiate a search with a multiple selection in which all selections are empty, show a message that a search region could not be constructed from the selection. Previous behavior was to become unresponsive, requiring the user to force-close Notepad++. Addresses issue #13.

## Version 0.7.4-alpha -- October 10th, 2023

* The **Align numeric** command and the **Numeric aligned** option of the **Calculate...** command now take into account numbers formatted as times, based on the settings in the **Time formats** dialog.
Expand Down
Binary file modified src/ColumnsPlusPlus.rc
Binary file not shown.
9 changes: 8 additions & 1 deletion src/Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,17 @@ bool convertSelectionToSearchRegion(ColumnsPlusPlusData& data) {
rs.extend();
if (!rs.size()) return false;
}
int n = data.sci.Selections();
for (int i = 0;; ++i) {
if (i >= n) {
MessageBox(data.searchData.dialog, L"Could not construct a search region from this selection.", L"Search in indicated region", MB_ICONERROR);
return false;
}
if (data.sci.SelectionNStart(i) < data.sci.SelectionNEnd(i)) break;
}
data.sci.SetIndicatorCurrent(data.searchData.indicator);
data.sci.IndicatorClearRange(0, data.sci.Length());
data.sci.SetIndicatorValue(1);
int n = data.sci.Selections();
for (int i = 0; i < n; ++i) data.sci.IndicatorFillRange(data.sci.SelectionNStart(i), data.sci.SelectionNEnd(i) - data.sci.SelectionNStart(i));
if (data.searchData.autoClearSelection) data.sci.SetEmptySelection(data.sci.CurrentPos());
return true;
Expand Down

0 comments on commit 0fb1898

Please sign in to comment.