From 516dd7b28b8b14ad26824a89dd3ba4fffd04cabe Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 12 Nov 2021 09:18:20 +1100 Subject: Change SCI_GETTEXT, SCI_GETSELTEXT, and SCI_GETCURLINE to be more consistent with other APIs with respect to buffer lengths. --- doc/ScintillaDoc.html | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'doc/ScintillaDoc.html') diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 77412022a..e54059624 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -128,7 +128,7 @@

Scintilla Documentation

-

Last edited 21 October 2021 ZL

+

Last edited 12 November 2021 NH

Scintilla 5 has moved the lexers from Scintilla into a new Lexilla project.
@@ -551,12 +551,12 @@

SCI_GETTEXT(position length, char *text NUL-terminated) → position
- This returns at most length-1 characters of text from the start of the document plus one - terminating 0 character. When length-1 is beyond document length, it returns document length. + This returns at most length characters of text from the start of the document plus one + terminating 0 character. When length is beyond document length, it returns document length. To collect all the text in a document, use SCI_GETLENGTH to get the number of characters in the document (nLen), allocate a character - buffer of length nLen+1 bytes, then call SCI_GETTEXT(nLen+1, char - *text). If the text argument is 0 then the length that should be allocated to store the + buffer of length nLen+1 bytes, then call SCI_GETTEXT(nLen, char + *text). If the text argument is NULL(0) then the length that should be allocated to store the entire document is returned. If you then save the text, you should use SCI_SETSAVEPOINT to mark the text as unmodified.

@@ -586,7 +586,7 @@

SCI_GETLINE(line line, char *text) → position
This fills the buffer defined by text with the contents of the nominated line (lines start at - 0). The buffer is not terminated by a 0 character. It is up to you to make sure that the buffer + 0). The buffer is not terminated by a NUL(0) character. It is up to you to make sure that the buffer is long enough for the text, use SCI_LINELENGTH(line line). The returned value is the number of characters copied to the buffer. The returned text includes any end of line @@ -1499,9 +1499,9 @@ struct Sci_TextToFind { href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE(line).

SCI_GETSELTEXT(<unused>, char *text NUL-terminated) → position
- This copies the currently selected text and a terminating 0 byte to the text - buffer. The buffer size should be determined by calling with a NULL pointer for the text argument - SCI_GETSELTEXT(0,0). + This copies the currently selected text and a terminating NUL(0) byte to the text + buffer. The buffer size should be determined by calling with a NULL pointer for the text argument: + 1 + SCI_GETSELTEXT(0, NULL). This allows for rectangular and discontiguous selections as well as simple selections. See Multiple Selection for information on how multiple and rectangular selections and virtual space are copied.

@@ -1516,10 +1516,10 @@ struct Sci_TextToFind {

SCI_GETCURLINE(position length, char *text NUL-terminated) → position
This retrieves the text of the line containing the caret and returns the position within the line of the caret. Pass in char* text pointing at a buffer large enough to hold - the text you wish to retrieve and a terminating 0 character. + the text you wish to retrieve and a terminating NUL(0) character. Set length to the - length of the buffer which must be at least 1 to hold the terminating 0 character. - If the text argument is 0 then the length that should be allocated + length of the buffer not including the terminating NUL character. + If the text argument is NULL(0) then the length that should be allocated to store the entire current line is returned.

See also: SCI_GETSELTEXT,