mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-28 08:14:18 +02:00
Fix crash issue on clomn mode editor
If empty column(s) is/are selected in column mode: create a new document then Alt-Shift + Arrow right key to select, launch colomn mode editor to insert some number -> NPP crash. Fixes #2820, Closes #2850
This commit is contained in:
parent
1caa457aae
commit
2119b171af
@ -2765,6 +2765,11 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in
|
||||
{
|
||||
assert(repeat > 0);
|
||||
|
||||
// If there is no column mode info available, no need to do anything
|
||||
// If required a message can be shown to user, that select column properly or something similar
|
||||
// It is just a double check as taken in callee method (in case this method is called from multiple places)
|
||||
if (cmi.size() <= 0)
|
||||
return;
|
||||
// 0000 00 00 : Dec BASE_10
|
||||
// 0000 00 01 : Hex BASE_16
|
||||
// 0000 00 10 : Oct BASE_08
|
||||
|
@ -158,10 +158,16 @@ INT_PTR CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
||||
if ((*_ppEditView)->execute(SCI_SELECTIONISRECTANGLE) || (*_ppEditView)->execute(SCI_GETSELECTIONS) > 1)
|
||||
{
|
||||
ColumnModeInfos colInfos = (*_ppEditView)->getColumnModeSelectInfo();
|
||||
std::sort(colInfos.begin(), colInfos.end(), SortInPositionOrder());
|
||||
(*_ppEditView)->columnReplace(colInfos, initialNumber, increaseNumber, repeat, format);
|
||||
std::sort(colInfos.begin(), colInfos.end(), SortInSelectOrder());
|
||||
(*_ppEditView)->setMultiSelections(colInfos);
|
||||
|
||||
// If there is no column mode info available, no need to do anything
|
||||
// If required a message can be shown to user, that select column properly or something similar
|
||||
if (colInfos.size() > 0)
|
||||
{
|
||||
std::sort(colInfos.begin(), colInfos.end(), SortInPositionOrder());
|
||||
(*_ppEditView)->columnReplace(colInfos, initialNumber, increaseNumber, repeat, format);
|
||||
std::sort(colInfos.begin(), colInfos.end(), SortInSelectOrder());
|
||||
(*_ppEditView)->setMultiSelections(colInfos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user