Skip to content

Commit 09a4cc1

Browse files
committed
PromptDialog bug, search and replace bugs
- Fixed bug 3040970 - PromptDialog crashed if a message was sent before WM_INITDIALOG - Fixed bug 3040902 - pyreplace and friends when searching for "$". - Added startLine, endLine and startPosition, endPosition to py(ml)replace/search - Fixed bug 3040972 - ConsoleDialog crashed on empty history due to uninitialised iterator (could not reproduce, but empty iterator could cause the issue) - Added changes to documentation. - Changed download links to Sourceforge on website.
1 parent 27c40a6 commit 09a4cc1

File tree

8 files changed

+296
-49
lines changed

8 files changed

+296
-49
lines changed

PythonScript/src/ConsoleDialog.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ using namespace std;
1111
ConsoleDialog::ConsoleDialog()
1212
: DockingDlgInterface(IDD_CONSOLE),
1313
m_prompt(">>> "),
14-
m_scintilla(NULL)
14+
m_scintilla(NULL),
15+
m_currentHistory(0)
1516
{
16-
17+
m_historyIter = m_history.end();
1718
}
1819

1920
ConsoleDialog::~ConsoleDialog()

PythonScript/src/PromptDialog.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ BOOL CALLBACK PromptDialog::dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
4848
default:
4949
{
5050
PromptDialog* dlg = reinterpret_cast<PromptDialog*>(::GetWindowLongPtr(hWnd, GWL_USERDATA));
51-
return dlg->runDlgProc(hWnd, message, wParam, lParam);
51+
if (dlg)
52+
return dlg->runDlgProc(hWnd, message, wParam, lParam);
53+
else
54+
return TRUE;
55+
5256
}
5357
}
5458
}

PythonScript/src/ScintillaPython.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ BOOST_PYTHON_MODULE(Npp)
1919
{
2020
register_exception_translator<out_of_bounds_exception>(&PythonScript::translateOutOfBounds);
2121
class_<ScintillaWrapper>("Editor", no_init)
22+
.def_readonly("INCLUDELINEENDINGS", &ScintillaWrapper::RE_INCLUDELINEENDINGS)
2223
.def("write", &ScintillaWrapper::AddText, "Add text to the document at current position (alias for addText).")
2324
.def("callback", &ScintillaWrapper::callback, "Registers a callback to a Python function when a Scintilla event occurs. e.g. editor.callback(my_function, [ScintillaNotification.CHARADDED])")
2425
.def("__getitem__", &ScintillaWrapper::GetLine, "Gets a line from the given (zero based) index")
@@ -38,16 +39,24 @@ BOOST_PYTHON_MODULE(Npp)
3839
.def("replace", &ScintillaWrapper::replaceNoFlags, "Simple search and replace. replace(searchFor, replaceWith[, flags]) where flags are members of Npp.FIND")
3940
.def("rereplace", &ScintillaWrapper::rereplace, "Simple regular expression search and replace (using Notepad++/Scintilla regular expressions). rereplace(searchExpression, replaceString[, flags]) Use Npp.FIND for the flags")
4041
.def("rereplace", &ScintillaWrapper::rereplaceNoFlags, "Simple regular expression search and replace (using Notepad++/Scintilla regular expressions). rereplace(searchExpression, replaceString[, flags]) Use Npp.FIND for the flags")
41-
.def("pyreplace", &ScintillaWrapper::pyreplace, "Python regular expression search and replace. Full support for Python regular expressions. Works line-by-line, so does not require significant memory overhead, however multiline regular expressions won't work (see pymlreplace). editor.pyreplace(search, replace[, count[, flags]]). Uses the python re.sub() method.")
42-
.def("pyreplace", &ScintillaWrapper::pyreplaceNoFlags, "Python regular expression search and replace. Full support for Python regular expressions. Works line-by-line, so does not require significant memory overhead, however multiline regular expressions won't work (see pymlreplace). editor.pyreplace(search, replace[, count[, flags]]). Uses the python re.sub() method.")
43-
.def("pyreplace", &ScintillaWrapper::pyreplaceNoFlagsNoCount, "Python regular expression search and replace. Full support for Python regular expressions. Works line-by-line, so does not require significant memory overhead, however multiline regular expressions won't work (see pymlreplace). editor.pyreplace(search, replace[, count[, flags]]). Uses the python re.sub() method.")
44-
.def("pymlreplace", &ScintillaWrapper::pymlreplace, "Python Multiline regular expression search and replace - works for multiline regular expressions, but makes at least 2 copies of the entire document, so is unsuitable for large documents. Note that re.MULTILINE is specified in the flags automatically. editor.pymlreplace(search, replace[, count[, flags]]). Uses the python re.sub() method.")
45-
.def("pymlreplace", &ScintillaWrapper::pymlreplaceNoFlags, "Python Multiline regular expression search and replace - works for multiline regular expressions, but makes at least 2 copies of the entire document, so is unsuitable for large documents. Note that re.MULTILINE is specified in the flags automatically. editor.pymlreplace(search, replace[, count[, flags]]). Uses the python re.sub() method.")
46-
.def("pymlreplace", &ScintillaWrapper::pymlreplaceNoFlagsNoCount, "Python Multiline regular expression search and replace - works for multiline regular expressions, but makes at least 2 copies of the entire document, so is unsuitable for large documents. Note that re.MULTILINE is specified in the flags automatically. editor.pymlreplace(search, replace[, count[, flags]]). Uses the python re.sub() method.")
47-
.def("pysearch", &ScintillaWrapper::pysearch, "Python regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \npysearch(expression, function[, flags])")
48-
.def("pysearch", &ScintillaWrapper::pysearchNoFlags, "Python regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \npysearch(expression, function[, flags])")
49-
.def("pymlsearch", &ScintillaWrapper::pymlsearch, "Python multiline regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \nNote that this runs the search on the entire text, and therefore makes at least 2 copies of the entire document, therefore it may not be suitable for large documents.\n pymlsearch(expression, function[, flags])")
50-
.def("pymlsearch", &ScintillaWrapper::pymlsearchNoFlags, "Python multiline regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \nNote that this runs the search on the entire text, and therefore makes at least 2 copies of the entire document, therefore it may not be suitable for large documents.\n pymlsearch(expression, function[, flags])")
42+
.def("pyreplace", &ScintillaWrapper::pyreplace, "Python regular expression search and replace. Full support for Python regular expressions. Works line-by-line, so does not require significant memory overhead, however multiline regular expressions won't work (see pymlreplace). editor.pyreplace(search, replace[, count[, flags[, startLine[, endLine]]]]). Uses the python re.sub() method.")
43+
.def("pyreplace", &ScintillaWrapper::pyreplaceNoFlags, "Python regular expression search and replace. Full support for Python regular expressions. Works line-by-line, so does not require significant memory overhead, however multiline regular expressions won't work (see pymlreplace). editor.pyreplace(search, replace[, count[, flags[, startLine[, endLine]]]]). Uses the python re.sub() method.")
44+
.def("pyreplace", &ScintillaWrapper::pyreplaceNoFlagsNoCount, "Python regular expression search and replace. Full support for Python regular expressions. Works line-by-line, so does not require significant memory overhead, however multiline regular expressions won't work (see pymlreplace). editor.pyreplace(search, replace[, count[, flags[, startLine[, endLine]]]]). Uses the python re.sub() method.")
45+
.def("pyreplace", &ScintillaWrapper::pyreplaceNoStartEnd, "Python regular expression search and replace. Full support for Python regular expressions. Works line-by-line, so does not require significant memory overhead, however multiline regular expressions won't work (see pymlreplace). editor.pyreplace(search, replace[, count[, flags[, startLine[, endLine]]]]). Uses the python re.sub() method.")
46+
.def("pyreplace", &ScintillaWrapper::pyreplaceNoEnd, "Python regular expression search and replace. Full support for Python regular expressions. Works line-by-line, so does not require significant memory overhead, however multiline regular expressions won't work (see pymlreplace). editor.pyreplace(search, replace[, count[, flags[, startLine[, endLine]]]]). Uses the python re.sub() method.")
47+
.def("pymlreplace", &ScintillaWrapper::pymlreplace, "Python Multiline regular expression search and replace - works for multiline regular expressions, but makes at least 2 copies of the entire document, so is unsuitable for large documents. Note that re.MULTILINE is specified in the flags automatically. editor.pymlreplace(search, replace[, count[, flags[, startPosition[, endPosition]]]]). Uses the python re.sub() method.")
48+
.def("pymlreplace", &ScintillaWrapper::pymlreplaceNoFlags, "Python Multiline regular expression search and replace - works for multiline regular expressions, but makes at least 2 copies of the entire document, so is unsuitable for large documents. Note that re.MULTILINE is specified in the flags automatically. editor.pymlreplace(search, replace[, count[, flags[, startPosition[, endPosition]]]]). Uses the python re.sub() method.")
49+
.def("pymlreplace", &ScintillaWrapper::pymlreplaceNoFlagsNoCount, "Python Multiline regular expression search and replace - works for multiline regular expressions, but makes at least 2 copies of the entire document, so is unsuitable for large documents. Note that re.MULTILINE is specified in the flags automatically. editor.pymlreplace(search, replace[, count[, flags[, startPosition[, endPosition]]]]). Uses the python re.sub() method.")
50+
.def("pymlreplace", &ScintillaWrapper::pymlreplaceNoStartEnd, "Python Multiline regular expression search and replace - works for multiline regular expressions, but makes at least 2 copies of the entire document, so is unsuitable for large documents. Note that re.MULTILINE is specified in the flags automatically. editor.pymlreplace(search, replace[, count[, flags[, startPosition[, endPosition]]]]). Uses the python re.sub() method.")
51+
.def("pymlreplace", &ScintillaWrapper::pymlreplaceNoEnd, "Python Multiline regular expression search and replace - works for multiline regular expressions, but makes at least 2 copies of the entire document, so is unsuitable for large documents. Note that re.MULTILINE is specified in the flags automatically. editor.pymlreplace(search, replace[, count[, flags[, startPosition[, endPosition]]]]). Uses the python re.sub() method.")
52+
.def("pysearch", &ScintillaWrapper::pysearch, "Python regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \npysearch(expression, function[, flags[, startLine[, endLine]]])")
53+
.def("pysearch", &ScintillaWrapper::pysearchNoFlags, "Python regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \npysearch(expression, function[, flags[, startLine[, endLine]]])")
54+
.def("pysearch", &ScintillaWrapper::pysearchNoStartEnd, "Python regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \npysearch(expression, function[, flags[, startLine[, endLine]]])")
55+
.def("pysearch", &ScintillaWrapper::pysearchNoEnd, "Python regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \npysearch(expression, function[, flags[, startLine[, endLine]]])")
56+
.def("pymlsearch", &ScintillaWrapper::pymlsearch, "Python multiline regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \nNote that this runs the search on the entire text, and therefore makes at least 2 copies of the entire document, therefore it may not be suitable for large documents.\n pymlsearch(expression, function[, flags[, startPosition[, endPosition]]])")
57+
.def("pymlsearch", &ScintillaWrapper::pymlsearchNoFlags, "Python multiline regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \nNote that this runs the search on the entire text, and therefore makes at least 2 copies of the entire document, therefore it may not be suitable for large documents.\n pymlsearch(expression, function[, flags[, startPosition[, endPosition]]])")
58+
.def("pymlsearch", &ScintillaWrapper::pymlsearchNoStartEnd, "Python multiline regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \nNote that this runs the search on the entire text, and therefore makes at least 2 copies of the entire document, therefore it may not be suitable for large documents.\n pymlsearch(expression, function[, flags[, startPosition[, endPosition]]])")
59+
.def("pymlsearch", &ScintillaWrapper::pymlsearchNoEnd, "Python multiline regular expression search, calling a function for each match found. The function gets called with the (zero indexed) line number, and the match object. \nNote that this runs the search on the entire text, and therefore makes at least 2 copies of the entire document, therefore it may not be suitable for large documents.\n pymlsearch(expression, function[, flags[, startPosition[, endPosition]]])")
5160
/* Between the autogenerated comments is, surprise, autogenerated
5261
* Do not edit the contents between these comments,
5362
* edit "CreateWrapper.py" instead, which does the generation

0 commit comments

Comments
 (0)