diff options
-rw-r--r-- | doc/ScintillaDoc.html | 126 | ||||
-rw-r--r-- | include/Scintilla.h | 4 | ||||
-rw-r--r-- | include/Scintilla.iface | 10 | ||||
-rw-r--r-- | src/Editor.cxx | 40 | ||||
-rw-r--r-- | src/Editor.h | 2 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 5 |
6 files changed, 124 insertions, 63 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 7d6cd8837..9324afda7 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -71,7 +71,7 @@ <p>The GTK+ version also uses messages in a similar way to the Windows version. This is different to normal GTK+ practice but made it easier to implement rapidly.</p> - <p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew. + <p>Scintilla does not properly support right-to-left languages like Arabic and Hebrew. While text in these languages may appear correct, it is not possible to interact with this text as is normal with other editing components.</p> @@ -237,7 +237,7 @@ <td>o <a class="toc" href="#KeyBindings">Key bindings</a></td> <td>o <a class="toc" href="#PopupEditMenu">Popup edit menu</a></td> - + <td>o <a class="toc" href="#MacroRecording">Macro recording</a></td> </tr> @@ -245,7 +245,7 @@ <td>o <a class="toc" href="#Printing">Printing</a></td> <td>o <a class="toc" href="#DirectAccess">Direct access</a></td> - + <td>o <a class="toc" href="#MultipleViews">Multiple views</a></td> </tr> @@ -253,7 +253,7 @@ <td>o <a class="toc" href="#Folding">Folding</a></td> <td>o <a class="toc" href="#LineWrapping">Line wrapping</a></td> - + <td>o <a class="toc" href="#Zooming">Zooming</a></td> </tr> @@ -261,7 +261,7 @@ <td>o <a class="toc" href="#LongLines">Long lines</a></td> <td>o <a class="toc" href="#Lexer">Lexer</a></td> - + <td>o <a class="toc" href="#Notifications">Notifications</a></td> </tr> @@ -269,7 +269,7 @@ <td>o <a class="toc" href="#GTK">GTK+</a></td> <td>o <a class="toc" href="#DeprecatedMessages">Deprecated messages</a></td> - + <td>o <a class="toc" href="#EditMessagesNeverSupportedByScintilla">Edit messages never supported by Scintilla</a></td> @@ -751,7 +751,7 @@ struct TextToFind { <code>SCI_REPLACETARGET</code> or <code>SCI_REPLACETARGETRE</code>.</p> <p>Searching can be performed within the target range with <code>SCI_SEARCHINTARGET</code>, - which uses a counted string to allow searching for null characters. It returns the + which uses a counted string to allow searching for null characters. It returns the position of the start of the matching text range or -1 for failure, in which case the target is not moved. The flags used by <code>SCI_SEARCHINTARGET</code> such as <code>SCFIND_MATCHCASE</code>, <code>SCFIND_WHOLEWORD</code>, <code>SCFIND_WORDSTART</code>, and <code>SCFIND_REGEXP</code> @@ -888,7 +888,7 @@ struct TextToFind { <p><b id="SCI_SETSTATUS">SCI_SETSTATUS(int status)</b><br /> <b id="SCI_GETSTATUS">SCI_GETSTATUS</b><br /> If an error occurs, Scintilla may set an internal error number that can be retrieved with - <code>SCI_GETSTATUS</code>. + <code>SCI_GETSTATUS</code>. To clear the error status call <code>SCI_SETSTATUS(0)</code>. The currently defined statuses are: @@ -986,12 +986,12 @@ struct TextToFind { combined with the preceding or following operations if they are undone.</p> <p><b id="SCI_ADDUNDOACTION">SCI_ADDUNDOACTION(int token, int flags)</b><br /> - The container can add its own actions into the undo stack by calling - <code>SCI_ADDUNDOACTION</code> and an <code>SCN_MODIFIED</code> - notification will be sent to the container with the + The container can add its own actions into the undo stack by calling + <code>SCI_ADDUNDOACTION</code> and an <code>SCN_MODIFIED</code> + notification will be sent to the container with the <a class="message" href="#SC_MOD_CONTAINER"><code>SC_MOD_CONTAINER</code></a> - flag when it is time to undo (<code>SC_PERFORMED_UNDO</code>) or - redo (<code>SC_PERFORMED_REDO</code>) the action. The token argument supplied is + flag when it is time to undo (<code>SC_PERFORMED_UNDO</code>) or + redo (<code>SC_PERFORMED_REDO</code>) the action. The token argument supplied is returned in the <code>token</code> field of the notification.</p> <p>For example, if the container wanted to allow undo and redo of a 'toggle bookmark' command then it could call <code>SCI_ADDUNDOACTION(line, 0)</code> each time the command is performed. @@ -999,13 +999,13 @@ struct TextToFind { the token field. If there are different types of commands or parameters that need to be stored into the undo stack then the container should maintain a stack of its own for the document and use the current position in that stack as the argument to <code>SCI_ADDUNDOACTION(line)</code>. - <code>SCI_ADDUNDOACTION</code> commands are not combined together + <code>SCI_ADDUNDOACTION</code> commands are not combined together into a single undo transaction unless grouped with <code>SCI_BEGINUNDOACTION</code> and <code>SCI_ENDUNDOACTION</code>.</p> - <p>The flags argument can be <code>UNDO_MAY_COALESCE</code> (1) if the container action may be + <p>The flags argument can be <code>UNDO_MAY_COALESCE</code> (1) if the container action may be coalesced along with any insertion and deletion actions into a single compound action, otherwise 0. - Coalescing treats coalescible container actions as transparent so will still only group together insertions that + Coalescing treats coalescible container actions as transparent so will still only group together insertions that look like typing or deletions that look like multiple uses of the Backspace or Delete keys. </p> <h2 id="SelectionAndInformation">Selection and information</h2> @@ -1215,15 +1215,15 @@ struct TextToFind { This copies the currently selected text and a terminating 0 byte to the <code>text</code> buffer. The buffer size should be determined by calling with a NULL pointer for the <code>text</code> argument <code>SCI_GETSELTEXT(0,0)</code>. - This allows for rectangular and discontiguous selections as well as simple selections. - See <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection</a> for information on + This allows for rectangular and discontiguous selections as well as simple selections. + See <a class="toc" href="#MultipleSelectionAndVirtualSpace">Multiple Selection</a> for information on how multiple and rectangular selections and virtual space are copied.</p> - - <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, - <a class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, - <a class="message" href="#SCI_GETTEXT">SCI_GETTEXT</a>, - <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, - <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a> + + <p>See also: <code><a class="message" href="#SCI_GETCURLINE">SCI_GETCURLINE</a>, + <a class="message" href="#SCI_GETLINE">SCI_GETLINE</a>, + <a class="message" href="#SCI_GETTEXT">SCI_GETTEXT</a>, + <a class="message" href="#SCI_GETSTYLEDTEXT">SCI_GETSTYLEDTEXT</a>, + <a class="message" href="#SCI_GETTEXTRANGE">SCI_GETTEXTRANGE</a> </code></p> <p><b id="SCI_GETCURLINE">SCI_GETCURLINE(int textLen, char *text)</b><br /> @@ -1393,7 +1393,7 @@ struct TextToFind { <b id="SCI_CHARPOSITIONFROMPOINTCLOSE">SCI_CHARPOSITIONFROMPOINTCLOSE(int x, int y)</b><br /> <code>SCI_CHARPOSITIONFROMPOINT</code> finds the closest character to a point and <code>SCI_CHARPOSITIONFROMPOINTCLOSE</code> is similar but returns -1 if the point is outside the - window or not close to any characters. This is similar to the previous methods but finds characters rather than + window or not close to any characters. This is similar to the previous methods but finds characters rather than inter-character positions.</p> <p><b id="SCI_POINTXFROMPOSITION">SCI_POINTXFROMPOSITION(<unused>, int pos)</b><br /> @@ -1419,6 +1419,8 @@ struct TextToFind { <a class="message" href="#SCI_GETMULTIPLESELECTION">SCI_GETMULTIPLESELECTION</a><br /> <a class="message" href="#SCI_SETADDITIONALSELECTIONTYPING">SCI_SETADDITIONALSELECTIONTYPING(bool additionalSelectionTyping)</a><br /> <a class="message" href="#SCI_GETADDITIONALSELECTIONTYPING">SCI_GETADDITIONALSELECTIONTYPING</a><br /> + <a class="message" href="#SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</a><br /> + <a class="message" href="#SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</a><br /> <a class="message" href="#SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpaceOptions)</a><br /> <a class="message" href="#SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</a><br /> <a class="message" href="#SCI_SETRECTANGULARSELECTIONMODIFIER">SCI_SETRECTANGULARSELECTIONMODIFIER(int modifier)</a><br /> @@ -1474,8 +1476,8 @@ struct TextToFind { </code> <p> - There may be multiple selections active at one time. - More selections are made by holding down the Ctrl key while dragging with the mouse. + There may be multiple selections active at one time. + More selections are made by holding down the Ctrl key while dragging with the mouse. The most recent selection is the main selection and determines which part of the document is shown automatically. Any selection apart from the main selection is called an additional selection. The calls in the previous section operate on the main selection. @@ -1489,11 +1491,11 @@ struct TextToFind { </p> <p> - Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be + Virtual space is space beyond the end of each line. The caret may be moved into virtual space but no real space will be added to the document until there is some text typed or some other text insertion command is used. </p> - - <p>When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text + + <p>When discontiguous selections are copied to the clipboard, each selection is added to the clipboard text in order with no delimiting characters. For rectangular selections the document's line end is added after each line's text. Rectangular selections are always copied from top line to bottom, not in the in order of selection.Virtual space is not copied.</p> @@ -1509,10 +1511,16 @@ struct TextToFind { Whether typing, backspace, or delete works with multiple selections simultaneously.</p> <p> + <b id="SCI_SETMULTIPASTE">SCI_SETMULTIPASTE(int multiPaste)</b><br /> + <b id="SCI_GETMULTIPASTE">SCI_GETMULTIPASTE</b><br /> + When pasting into multiple selections, the pasted text can go into just the main selection with <code>SC_MULTIPASTE_ONCE</code>=0 + or into each selection with <code>SC_MULTIPASTE_EACH</code>=1. <code>SC_MULTIPASTE_ONCE</code> is the default.</p> + + <p> <b id="SCI_SETVIRTUALSPACEOPTIONS">SCI_SETVIRTUALSPACEOPTIONS(int virtualSpace)</b><br /> <b id="SCI_GETVIRTUALSPACEOPTIONS">SCI_GETVIRTUALSPACEOPTIONS</b><br /> - Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both. - There are two bit flags <code>SCVS_RECTANGULARSELECTION</code>=1 and + Virtual space can be enabled or disabled for rectangular selections or in other circumstances or in both. + There are two bit flags <code>SCVS_RECTANGULARSELECTION</code>=1 and <code>SCVS_USERACCESSIBLE</code>=2 which can be set independently. <code>SCVS_NONE</code>=0, the default, disables all use of virtual space.</p> @@ -1522,13 +1530,13 @@ struct TextToFind { On GTK+, the key used to indicate that a rectangular selection should be created when combined with a mouse drag can be set. The three possible values are <code>SCMOD_CTRL</code>=2 (default), <code>SCMOD_ALT</code>=4 or <code>SCMOD_SUPER</code>=8. Since <code>SCMOD_ALT</code> is often already used by a window manager, the window manager may need configuring to allow this choice. - <code>SCMOD_SUPER</code> is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the + <code>SCMOD_SUPER</code> is often a system dependent modifier key such as the Left Windows key on a Windows keyboard or the Command key on a Mac.</p> <p> <b id="SCI_GETSELECTIONS">SCI_GETSELECTIONS</b><br /> Return the number of selections currently active.</p> - + <p> <b id="SCI_CLEARSELECTIONS">SCI_CLEARSELECTIONS</b><br /> Set a single empty selection at 0 as the only selection.</p> @@ -1539,7 +1547,7 @@ struct TextToFind { <p> <b id="SCI_ADDSELECTION">SCI_ADDSELECTION(int caret, int anchor)</b><br /> - Add a new selection from <code>anchor</code> to <code>caret</code> as the main selection retaining all other + Add a new selection from <code>anchor</code> to <code>caret</code> as the main selection retaining all other selections as additional selections. Since there is always at least one selection, to set a list of selections, the first selection should be added with <code>SCI_SETSELECTION</code> and later selections added with <code>SCI_ADDSELECTION</code></p> @@ -1972,7 +1980,7 @@ struct TextToFind { <a class="message" href="#SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</a><br /> <a class="message" href="#SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</a><br /> </code> - + <p><b id="SCI_SETVIEWWS">SCI_SETVIEWWS(int wsMode)</b><br /> <b id="SCI_GETVIEWWS">SCI_GETVIEWWS</b><br /> White space can be made visible which may be useful for languages in which white space is @@ -2033,10 +2041,10 @@ struct TextToFind { <b id="SCI_GETEXTRAASCENT">SCI_GETEXTRAASCENT</b><br /> <b id="SCI_SETEXTRADESCENT">SCI_SETEXTRADESCENT(int extraDescent)</b><br /> <b id="SCI_GETEXTRADESCENT">SCI_GETEXTRADESCENT</b><br /> - Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum - that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the + Text is drawn with the base of each character on a 'baseline'. The height of a line is found from the maximum + that any style extends above the baseline (its 'ascent'), added to the maximum that any style extends below the baseline (its 'descent'). - Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the + Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines. This may done to make the text easier to read or to accomodate underlines or highlights. <p> @@ -2643,7 +2651,7 @@ struct TextToFind { is hidden. Margin 1 is set to display non-folding symbols and is given a width of 16 pixels, so it is visible. Margin 2 is set to display the folding symbols, but is given a width of 0, so it is hidden. Of course, you can set the margins to be whatever you wish.</p> - + <p>Styled text margins used to show revision and blame information:</p> <p><img src="styledmargin.png" alt="Styled text margins used to show revision and blame information" /></p> @@ -2757,20 +2765,20 @@ struct TextToFind { <b id="SCI_MARGINSETSTYLES">SCI_MARGINSETSTYLES(int line, char *styles)</b><br /> <b id="SCI_MARGINGETSTYLES">SCI_MARGINGETSTYLES(int line, char *styles)</b><br /> <b id="SCI_MARGINTEXTCLEARALL">SCI_MARGINTEXTCLEARALL</b><br /> - Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT. + Text margins are created with the type SC_MARGIN_TEXT or SC_MARGIN_RTEXT. A different string may be set for each line with <code>SCI_MARGINSETTEXT</code>. - The whole of the text margin on a line may be displayed in a particular style with - <code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with + The whole of the text margin on a line may be displayed in a particular style with + <code>SCI_MARGINSETSTYLE</code> or each character may be individually styled with <code>SCI_MARGINSETSTYLES</code> which uses an array of bytes with each byte setting the style of the corresponding text byte simlar to <code>SCI_SETSTYLINGEX</code>. - Setting a text margin will cause a + Setting a text margin will cause a <a class="message" href="#SC_MOD_CHANGEMARGIN"><code>SC_MOD_CHANGEMARGIN</code></a> notification to be sent. </p> <p> <b id="SCI_MARGINSETSTYLEOFFSET">SCI_MARGINSETSTYLEOFFSET(int style)</b><br /> <b id="SCI_MARGINGETSTYLEOFFSET">SCI_MARGINGETSTYLEOFFSET</b><br /> - Margin styles may be completely separated from standard text styles by setting a style offset. For example, + Margin styles may be completely separated from standard text styles by setting a style offset. For example, <code>SCI_MARGINSETSTYLEOFFSET(256)</code> would allow the margin styles to be numbered from 256 upto 511 so they do not overlap styles set by lexers. Each style number set with <code>SCI_MARGINSETSTYLE</code> or <code>SCI_MARGINSETSTYLES</code> has the offset added before looking up the style. @@ -2779,8 +2787,8 @@ struct TextToFind { <h2 id="Annotations">Annotations</h2> <p>Annotations are read-only lines of text underneath each line of editable text. - An annotation may consist of multiple lines separated by '\n'. - Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to + An annotation may consist of multiple lines separated by '\n'. + Annotations can be used to display an assembler version of code for debugging or to show diagnostic messages inline or to line up different versions of text in a merge tool.</p> <p>Annotations used for inline diagnostics:</p> <p><img src="annotations.png" alt="Annotations used for inline diagnostics" /></p> @@ -2811,12 +2819,12 @@ struct TextToFind { <b id="SCI_ANNOTATIONCLEARALL">SCI_ANNOTATIONCLEARALL</b><br /> A different string may be set for each line with <code>SCI_ANNOTATIONSETTEXT</code>. To clear annotations call <code>SCI_ANNOTATIONSETTEXT</code> with a NULL pointer. - The whole of the text ANNOTATION on a line may be displayed in a particular style with - <code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with + The whole of the text ANNOTATION on a line may be displayed in a particular style with + <code>SCI_ANNOTATIONSETSTYLE</code> or each character may be individually styled with <code>SCI_ANNOTATIONSETSTYLES</code> which uses an array of bytes with each byte setting the style of the corresponding text byte simlar to <code>SCI_SETSTYLINGEX</code>. The text must be set first as it specifies how long the annotation is so how many bytes of styling to read. - Setting an annotation will cause a + Setting an annotation will cause a <a class="message" href="#SC_MOD_CHANGEANNOTATION"><code>SC_MOD_CHANGEANNOTATION</code></a> notification to be sent. </p> @@ -2829,7 +2837,7 @@ struct TextToFind { <b id="SCI_ANNOTATIONSETVISIBLE">SCI_ANNOTATIONSETVISIBLE(int visible)</b><br /> <b id="SCI_ANNOTATIONGETVISIBLE">SCI_ANNOTATIONGETVISIBLE</b><br /> Annotations can be made visible in a view and there is a choice of display style when visible. - The two messages set and get the annotation display mode. The <code>visible</code> + The two messages set and get the annotation display mode. The <code>visible</code> argument can be one of:</p> <table cellpadding="1" cellspacing="2" border="0" summary="Annotation visibility"> @@ -2864,9 +2872,9 @@ struct TextToFind { <p> <b id="SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</b><br /> <b id="SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</b><br /> - Annotation styles may be completely separated from standard text styles by setting a style offset. For example, + Annotation styles may be completely separated from standard text styles by setting a style offset. For example, <code>SCI_ANNOTATIONSETSTYLEOFFSET(512)</code> would allow the annotation styles to be numbered from - 512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256). + 512 upto 767 so they do not overlap styles set by lexers (or margins if margins offset is 256). Each style number set with <code>SCI_ANNOTATIONSETSTYLE</code> or <code>SCI_ANNOTATIONSETSTYLES</code> has the offset added before looking up the style. </p> @@ -2977,7 +2985,7 @@ struct TextToFind { <p>On GTK+, code page can be set to 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), or 950 (Traditional Chinese Big5). The code page may also be set to <code>SC_CP_DBCS</code> (1) - which uses the current locale to handle multi byte characters which may work for otherwise unsupported + which uses the current locale to handle multi byte characters which may work for otherwise unsupported code pages.</p> <p>For GTK+ 1.x, the locale should be set to a Unicode locale with a call similar to @@ -3254,8 +3262,8 @@ struct TextToFind { The <code>SC_MARK_EMPTY</code> symbol is invisible, allowing client code to track the movement of lines. You would also use it if you changed the folding style and wanted one or more of the <code>SC_FOLDERNUM_</code>* markers to have no associated symbol.</p> - - <p>Applications may use the marker symbol <code>SC_MARK_AVAILABLE</code> to indicate that + + <p>Applications may use the marker symbol <code>SC_MARK_AVAILABLE</code> to indicate that plugins may allocate that marker number. </p> @@ -3400,7 +3408,7 @@ struct TextToFind { the XPM format <a class="jump" href="http://koala.ilog.fr/lehors/xpm.html">here</a>.</p> <p><b id="SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)</b><br /> - Returns the symbol defined for a markerNumber with <code>SCI_MARKERDEFINE</code> + Returns the symbol defined for a markerNumber with <code>SCI_MARKERDEFINE</code> or <code>SC_MARK_PIXMAP</code> if defined with <code>SCI_MARKERDEFINEPIXMAP</code>.</p> <p><b id="SCI_MARKERSETFORE">SCI_MARKERSETFORE(int markerNumber, int <a class="jump" @@ -4959,7 +4967,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ <tr> <td align="left"><code>SC_WRAPINDENT_FIXED</code></td> <td align="center">0</td> - <td>Wrapped sublines aligned to left of window plus amount set by + <td>Wrapped sublines aligned to left of window plus amount set by <a class="message" href="#SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT</a></td> </tr> @@ -5739,7 +5747,7 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber); <td align="center">0x40000</td> - <td>This is set on for actions that the container stored into the undo stack with + <td>This is set on for actions that the container stored into the undo stack with <a class="message" href="#SCI_ADDUNDOACTION"><code>SCI_ADDUNDOACTION</code></a>. </td> diff --git a/include/Scintilla.h b/include/Scintilla.h index a702fd90d..d1f4518fd 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -486,6 +486,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETFONTQUALITY 2611 #define SCI_GETFONTQUALITY 2612 #define SCI_SETFIRSTVISIBLELINE 2613 +#define SC_MULTIPASTE_ONCE 0 +#define SC_MULTIPASTE_EACH 1 +#define SCI_SETMULTIPASTE 2614 +#define SCI_GETMULTIPASTE 2615 #define SCI_TARGETFROMSELECTION 2287 #define SCI_LINESJOIN 2288 #define SCI_LINESSPLIT 2289 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index f2c8f1ebf..67fcc6060 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1223,6 +1223,16 @@ get int GetFontQuality=2612(,) # Scroll so that a display line is at the top of the display. set void SetFirstVisibleLine=2613(int lineDisplay,) +enu MultiPaste=SC_MULTIPASTE_ +val SC_MULTIPASTE_ONCE=0 +val SC_MULTIPASTE_EACH=1 + +# Change the effect of pasting when there are multiple selections. +set void SetMultiPaste=2614(int multiPaste,) + +# Retrieve the effect of pasting when there are multiple selections.. +get int GetMultiPaste=2615(,) + # Make the target range start and end be the same as the selection range start and end. fun void TargetFromSelection=2287(,) diff --git a/src/Editor.cxx b/src/Editor.cxx index 4cc275e71..54fb6185b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -150,6 +150,7 @@ Editor::Editor() { caretSticky = false; multipleSelection = false; additionalSelectionTyping = false; + multiPasteMode = SC_MULTIPASTE_ONCE; additionalCaretsBlink = true; additionalCaretsVisible = true; virtualSpaceOptions = SCVS_NONE; @@ -3797,6 +3798,38 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { } } +void Editor::InsertPaste(SelectionPosition selStart, const char *text, int len) { + if (multiPasteMode == SC_MULTIPASTE_ONCE) { + selStart = SelectionPosition(InsertSpace(selStart.Position(), selStart.VirtualSpace())); + if (pdoc->InsertString(selStart.Position(), text, len)) { + SetEmptySelection(selStart.Position() + len); + } + } else { + // SC_MULTIPASTE_EACH + for (size_t r=0; r<sel.Count(); r++) { + if (!RangeContainsProtected(sel.Range(r).Start().Position(), + sel.Range(r).End().Position())) { + int positionInsert = sel.Range(r).Start().Position(); + if (!sel.Range(r).Empty()) { + if (sel.Range(r).Length()) { + pdoc->DeleteChars(positionInsert, sel.Range(r).Length()); + sel.Range(r).ClearVirtualSpace(); + } else { + // Range is all virtual so collapse to start of virtual space + sel.Range(r).MinimizeVirtualSpace(); + } + } + positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); + if (pdoc->InsertString(positionInsert, text, len)) { + sel.Range(r).caret.SetPosition(positionInsert + len); + sel.Range(r).anchor.SetPosition(positionInsert + len); + } + sel.Range(r).ClearVirtualSpace(); + } + } + } +} + void Editor::ClearSelection() { if (!sel.IsRectangular()) FilterSelections(); @@ -8282,6 +8315,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETADDITIONALSELECTIONTYPING: return additionalSelectionTyping; + case SCI_SETMULTIPASTE: + multiPasteMode = wParam; + break; + + case SCI_GETMULTIPASTE: + return multiPasteMode; + case SCI_SETADDITIONALCARETSBLINK: additionalCaretsBlink = wParam != 0; InvalidateCaret(); diff --git a/src/Editor.h b/src/Editor.h index 94454b2d9..6e6c25f0f 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -142,6 +142,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool caretSticky; bool multipleSelection; bool additionalSelectionTyping; + int multiPasteMode; bool additionalCaretsBlink; bool additionalCaretsVisible; @@ -358,6 +359,7 @@ protected: // ScintillaBase subclass needs access to much of Editor int InsertSpace(int position, unsigned int spaces); void AddChar(char ch); virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); + void InsertPaste(SelectionPosition selStart, const char *text, int len); void ClearSelection(); void ClearAll(); void ClearDocumentStyle(); diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 9edd56ad3..d0f99c532 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1376,10 +1376,7 @@ void ScintillaWin::InsertPasteText(const char *text, int len, SelectionPosition SetEmptySelection(sel.MainCaret() + len); } } else { - selStart = SelectionPosition(InsertSpace(selStart.Position(), selStart.VirtualSpace())); - if (pdoc->InsertString(selStart.Position(), text, len)) { - SetEmptySelection(selStart.Position() + len); - } + InsertPaste(selStart, text, len); } delete []convertedText; } |