From c9394092df9b424b262e06139d2e4abdac8f78a3 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 10 Jun 2021 09:21:12 +1000 Subject: Rename SCI_PASTERECTANGULAR to SCI_REPLACERECTANGULAR as it is inserting text provided as an argument instead of from the system clipboard. --- doc/ScintillaDoc.html | 10 ++++++---- include/Scintilla.h | 2 +- include/Scintilla.iface | 4 ++-- include/ScintillaMessages.h | 2 +- src/Editor.cxx | 2 +- test/simpleTests.py | 4 ++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 01ec3e3ad..300ae0208 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -128,7 +128,7 @@

Scintilla Documentation

-

Last edited 28 May 2021 NH

+

Last edited 10 June 2021 NH

Scintilla 5 has moved the lexers from Scintilla into a new Lexilla project.
@@ -1107,7 +1107,7 @@ struct Sci_TextToFind { SCI_COPYALLOWLINE
SCI_SETPASTECONVERTENDINGS(bool convert)
SCI_GETPASTECONVERTENDINGS → bool
- SCI_PASTERECTANGULAR(position length, const char *text)
+ SCI_REPLACERECTANGULAR(position length, const char *text)

SCI_CUT
@@ -1148,8 +1148,10 @@ struct Sci_TextToFind { SCI_SETEOLMODE. Defaults to true.

-

SCI_PASTERECTANGULAR(position length, const char *text)
- Pastes the given text into the existing rectangular or empty selection, overwriting any selected text.

+

SCI_REPLACERECTANGULAR(position length, const char *text)
+ Replaces the selected text or empty selection with the given text. + The insertion is performed similarly to rectangular pastes: new lines in the given text are interpreted as + moving to the next line without inserting new lines unless at the end of the document.

Error handling

diff --git a/include/Scintilla.h b/include/Scintilla.h index c74332dc3..de96d81d8 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -885,7 +885,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_TOGGLECARETSTICKY 2459 #define SCI_SETPASTECONVERTENDINGS 2467 #define SCI_GETPASTECONVERTENDINGS 2468 -#define SCI_PASTERECTANGULAR 2771 +#define SCI_REPLACERECTANGULAR 2771 #define SCI_SELECTIONDUPLICATE 2469 #define SCI_SETCARETLINEBACKALPHA 2470 #define SCI_GETCARETLINEBACKALPHA 2471 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index d8e8fc21a..4cb76e3b3 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2439,8 +2439,8 @@ set void SetPasteConvertEndings=2467(bool convert,) # Get convert-on-paste setting get bool GetPasteConvertEndings=2468(,) -# Paste into a rectangular selection. -fun void PasteRectangular=2771(position length, string text) +# Replace the selection with text like a rectangular paste. +fun void ReplaceRectangular=2771(position length, string text) # Duplicate the selection. If selection empty duplicate the line containing the caret. fun void SelectionDuplicate=2469(,) diff --git a/include/ScintillaMessages.h b/include/ScintillaMessages.h index b5792d809..861981574 100644 --- a/include/ScintillaMessages.h +++ b/include/ScintillaMessages.h @@ -581,7 +581,7 @@ enum class Message { ToggleCaretSticky = 2459, SetPasteConvertEndings = 2467, GetPasteConvertEndings = 2468, - PasteRectangular = 2771, + ReplaceRectangular = 2771, SelectionDuplicate = 2469, SetCaretLineBackAlpha = 2470, GetCaretLineBackAlpha = 2471, diff --git a/src/Editor.cxx b/src/Editor.cxx index da22161c6..71aaeae53 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5940,7 +5940,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { EnsureCaretVisible(); break; - case Message::PasteRectangular: { + case Message::ReplaceRectangular: { UndoGroup ug(pdoc); if (!sel.Empty()) { ClearSelection(); // want to replace rectangular selection contents diff --git a/test/simpleTests.py b/test/simpleTests.py index 82ed84810..2d8b25e68 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -535,10 +535,10 @@ class TestSimple(unittest.TestCase): self.ed.Clear() self.assertEquals(self.ed.Contents(), b"1c") - def testPasteRectangular(self): + def testReplaceRectangular(self): self.ed.AddText(5, b"a\nb\nc") self.ed.SetSel(0,0) - self.ed.PasteRectangular(3, b"1\n2") + self.ed.ReplaceRectangular(3, b"1\n2") self.assertEquals(self.ed.Contents(), b"1a\n2b\nc") def testCopyAllowLine(self): -- cgit v1.2.3