diff options
| -rw-r--r-- | doc/ScintillaDoc.html | 5 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 4 | ||||
| -rw-r--r-- | include/Scintilla.h | 1 | ||||
| -rw-r--r-- | include/Scintilla.iface | 3 | ||||
| -rw-r--r-- | src/Document.cxx | 4 | ||||
| -rw-r--r-- | src/Document.h | 2 | ||||
| -rw-r--r-- | src/Editor.cxx | 5 | 
7 files changed, 20 insertions, 4 deletions
| diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index f4dfb1e06..6128a6aa6 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -4006,6 +4006,7 @@ struct Sci_TextToFind {       <a class="message" href="#SCI_BRACEHIGHLIGHTINDICATOR">SCI_BRACEHIGHLIGHTINDICATOR(bool useSetting, int indicator)</a><br />       <a class="message" href="#SCI_BRACEBADLIGHTINDICATOR">SCI_BRACEBADLIGHTINDICATOR(bool useSetting, int indicator)</a><br />       <a class="message" href="#SCI_BRACEMATCH">SCI_BRACEMATCH(position pos, int maxReStyle) → position</a><br /> +     <a class="message" href="#SCI_BRACEMATCHNEXT">SCI_BRACEMATCHNEXT(position pos, position startPos) → position</a><br />      </code>      <p><b id="SCI_BRACEHIGHLIGHT">SCI_BRACEHIGHLIGHT(position posA, position posB)</b><br /> @@ -4041,6 +4042,10 @@ struct Sci_TextToFind {      <code class="parameter">maxReStyle</code> parameter must currently be 0 - it may be used in the future to limit      the length of brace searches.</p> +    <p><b id="SCI_BRACEMATCHNEXT">SCI_BRACEMATCHNEXT(position pos, position startPos) → position</b><br /> +     Similar to <code>SCI_BRACEMATCH</code>, but matching starts at the explicit start position <code>startPos</code> +     instead of the implicitly next position <code>pos ± 1</code>.</p> +      <h2 id="TabsAndIndentationGuides">Tabs and Indentation Guides</h2>      <p>Indentation (the white space at the start of a line) is often used by programmers to clarify diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index f0e2dcca6..1d3f2c115 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -589,6 +589,10 @@  	<a href="https://sourceforge.net/p/scintilla/bugs/2184/">Bug #2184</a>.  	</li>  	<li> +	Add SCI_BRACEMATCHNEXT API. +	<a href="https://sourceforge.net/p/scintilla/feature-requests/1368/">Feature #1368</a>. +	</li> +	<li>  	Round SCI_TEXTWIDTH instead of truncating as this may be more accurate when sizing application  	elements to match text.  	<a href="https://sourceforge.net/p/scintilla/feature-requests/1355/">Feature #1355</a>. diff --git a/include/Scintilla.h b/include/Scintilla.h index d3b6ac237..56f153f94 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -685,6 +685,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,  #define SCI_BRACEBADLIGHT 2352  #define SCI_BRACEBADLIGHTINDICATOR 2499  #define SCI_BRACEMATCH 2353 +#define SCI_BRACEMATCHNEXT 2369  #define SCI_GETVIEWEOL 2355  #define SCI_SETVIEWEOL 2356  #define SCI_GETDOCPOINTER 2357 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index b8d92da19..a1b0f58aa 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -1876,6 +1876,9 @@ fun void BraceBadLightIndicator=2499(bool useSetting, int indicator)  # The maxReStyle must be 0 for now. It may be defined in a future release.  fun position BraceMatch=2353(position pos, int maxReStyle) +# Similar to BraceMatch, but matching starts at the explicit start position. +fun position BraceMatchNext=2369(position pos, position startPos) +  # Are the end of line characters visible?  get bool GetViewEOL=2355(,) diff --git a/src/Document.cxx b/src/Document.cxx index dcb26acdf..95792fa1f 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -2657,7 +2657,7 @@ static char BraceOpposite(char ch) noexcept {  }  // TODO: should be able to extend styled region to find matching brace -Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxReStyle*/) noexcept { +Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxReStyle*/, Sci::Position startPos, bool useStartPos) noexcept {  	const char chBrace = CharAt(position);  	const char chSeek = BraceOpposite(chBrace);  	if (chSeek == '\0') @@ -2667,7 +2667,7 @@ Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxRe  	if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')  		direction = 1;  	int depth = 1; -	position = NextPosition(position, direction); +	position = useStartPos ? startPos : NextPosition(position, direction);  	while ((position >= 0) && (position < LengthNoExcept())) {  		const char chAtPos = CharAt(position);  		const int styAtPos = StyleIndexAt(position); diff --git a/src/Document.h b/src/Document.h index 6e8507f04..37c37c4b8 100644 --- a/src/Document.h +++ b/src/Document.h @@ -501,7 +501,7 @@ public:  	Sci::Position ParaUp(Sci::Position pos) const;  	Sci::Position ParaDown(Sci::Position pos) const;  	int IndentSize() const noexcept { return actualIndentInChars; } -	Sci::Position BraceMatch(Sci::Position position, Sci::Position maxReStyle) noexcept; +	Sci::Position BraceMatch(Sci::Position position, Sci::Position maxReStyle, Sci::Position startPos, bool useStartPos) noexcept;  private:  	void NotifyModifyAttempt(); diff --git a/src/Editor.cxx b/src/Editor.cxx index 45cc42804..28fa89120 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7646,7 +7646,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_BRACEMATCH:  		// wParam is position of char to find brace for,  		// lParam is maximum amount of text to restyle to find it -		return pdoc->BraceMatch(static_cast<Sci::Position>(wParam), lParam); +		return pdoc->BraceMatch(static_cast<Sci::Position>(wParam), lParam, 0, false); + +	case SCI_BRACEMATCHNEXT: +		return pdoc->BraceMatch(static_cast<Sci::Position>(wParam), 0, lParam, true);  	case SCI_GETVIEWEOL:  		return vs.viewEOL; | 
