aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaDoc.html4
-rw-r--r--include/Scintilla.h1
-rw-r--r--include/Scintilla.iface3
-rw-r--r--src/Editor.cxx4
-rw-r--r--test/simpleTests.py7
5 files changed, 19 insertions, 0 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html
index c610b9c70..1651c0862 100644
--- a/doc/ScintillaDoc.html
+++ b/doc/ScintillaDoc.html
@@ -387,6 +387,7 @@
<a class="message" href="#SCI_APPENDTEXT">SCI_APPENDTEXT(int length, const char *s)</a><br />
<a class="message" href="#SCI_INSERTTEXT">SCI_INSERTTEXT(int pos, const char *text)</a><br />
<a class="message" href="#SCI_CLEARALL">SCI_CLEARALL</a><br />
+ <a class="message" href="#SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</a><br />
<a class="message" href="#SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</a><br />
<a class="message" href="#SCI_GETCHARAT">SCI_GETCHARAT(int position)</a><br />
<a class="message" href="#SCI_GETSTYLEAT">SCI_GETSTYLEAT(int position)</a><br />
@@ -519,6 +520,9 @@
<p><b id="SCI_CLEARALL">SCI_CLEARALL</b><br />
Unless the document is read-only, this deletes all the text.</p>
+ <p><b id="SCI_DELETERANGE">SCI_DELETERANGE(int pos, int deleteLength)</b><br />
+ Deletes a range of text in the document.</p>
+
<p><b id="SCI_CLEARDOCUMENTSTYLE">SCI_CLEARDOCUMENTSTYLE</b><br />
When wanting to completely restyle the document, for example after choosing a lexer, the
<code>SCI_CLEARDOCUMENTSTYLE</code> can be used to clear all styling information and reset the
diff --git a/include/Scintilla.h b/include/Scintilla.h
index e5d545349..8251726dc 100644
--- a/include/Scintilla.h
+++ b/include/Scintilla.h
@@ -51,6 +51,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_ADDSTYLEDTEXT 2002
#define SCI_INSERTTEXT 2003
#define SCI_CLEARALL 2004
+#define SCI_DELETERANGE 2645
#define SCI_CLEARDOCUMENTSTYLE 2005
#define SCI_GETLENGTH 2006
#define SCI_GETCHARAT 2007
diff --git a/include/Scintilla.iface b/include/Scintilla.iface
index e133be69d..7abbb68c1 100644
--- a/include/Scintilla.iface
+++ b/include/Scintilla.iface
@@ -101,6 +101,9 @@ fun void InsertText=2003(position pos, string text)
# Delete all text in the document.
fun void ClearAll=2004(,)
+# Delete a range of text in the document.
+fun void DeleteRange=2645(position pos, int deleteLength)
+
# Set all style bytes to 0, remove all folding information.
fun void ClearDocumentStyle=2005(,)
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 8aea4db1d..d72ff302c 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -7480,6 +7480,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
ClearAll();
return 0;
+ case SCI_DELETERANGE:
+ pdoc->DeleteChars(wParam, lParam);
+ return 0;
+
case SCI_CLEARDOCUMENTSTYLE:
ClearDocumentStyle();
return 0;
diff --git a/test/simpleTests.py b/test/simpleTests.py
index 5ad5cf987..8e101b84e 100644
--- a/test/simpleTests.py
+++ b/test/simpleTests.py
@@ -26,6 +26,13 @@ class TestSimple(unittest.TestCase):
self.ed.ClearAll()
self.assertEquals(self.ed.Length, 0)
+ def testDeleteRange(self):
+ self.ed.AddText(5, b"abcde")
+ self.assertEquals(self.ed.Length, 5)
+ self.ed.DeleteRange(1, 2)
+ self.assertEquals(self.ed.Length, 3)
+ self.assertEquals(self.ed.Contents(), b"ade")
+
def testAddStyledText(self):
self.assertEquals(self.ed.EndStyled, 0)
self.ed.AddStyledText(2, b"x\002")