Author: mkrueger
Date: 2008-02-14 10:29:29 -0500 (Thu, 14 Feb 2008)
New Revision: 95640
Modified:
trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
Log:
* Mono.TextEditor/TextViewMargin.cs: Fixed highlighting bracket drawing
issue.
Modified: trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-14
15:25:55 UTC (rev 95639)
+++ trunk/monodevelop/main/src/addins/Mono.Texteditor/ChangeLog 2008-02-14
15:29:29 UTC (rev 95640)
@@ -1,5 +1,10 @@
2008-02-14 Mike Krüger <[EMAIL PROTECTED]>
+ * Mono.TextEditor/TextViewMargin.cs: Fixed highlighting bracket drawing
+ issue.
+
+2008-02-14 Mike Krüger <[EMAIL PROTECTED]>
+
* Mono.TextEditor/TextViewMargin.cs, Mono.TextEditor/TextEditor.cs,
Mono.TextEditor/Caret.cs: Fixed caret drawing error.
Modified:
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
===================================================================
---
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
2008-02-14 15:25:55 UTC (rev 95639)
+++
trunk/monodevelop/main/src/addins/Mono.Texteditor/Mono.TextEditor/TextViewMargin.cs
2008-02-14 15:29:29 UTC (rev 95640)
@@ -135,19 +135,13 @@
return;
if (offset < 0)
offset = 0;
- char ch = Document.Buffer.GetCharAt (offset);
- int bracket = TextUtil.openBrackets.IndexOf
(ch);
int oldIndex = highlightBracketOffset;
- if (bracket >= 0) {
- highlightBracketOffset =
TextUtil.SearchMatchingBracketForward (Document, offset + 1, bracket);
- } else {
- bracket =
TextUtil.closingBrackets.IndexOf (ch);
- if (bracket >= 0) {
- highlightBracketOffset =
TextUtil.SearchMatchingBracketBackward (Document, offset - 1, bracket);
- } else {
- highlightBracketOffset = -1;
- }
- }
+ highlightBracketOffset =
GetMatchingBracketOffset (offset);
+ if (highlightBracketOffset == Caret.Offset &&
offset + 1 < Document.Buffer.Length)
+ highlightBracketOffset =
GetMatchingBracketOffset (offset + 1);
+ if (highlightBracketOffset == Caret.Offset)
+ highlightBracketOffset = -1;
+
if (highlightBracketOffset != oldIndex) {
int line1 = oldIndex >= 0 ?
Document.Splitter.OffsetToLineNumber (oldIndex) : -1;
int line2 = highlightBracketOffset >= 0
? Document.Splitter.OffsetToLineNumber (highlightBracketOffset) : -1;
@@ -162,6 +156,24 @@
textCursor = new Gdk.Cursor (Gdk.CursorType.Xterm);
}
+ int GetMatchingBracketOffset (int offset)
+ {
+ char ch = Document.Buffer.GetCharAt (offset);
+ int bracket = TextUtil.openBrackets.IndexOf (ch);
+ int result;
+ if (bracket >= 0) {
+ result = TextUtil.SearchMatchingBracketForward
(Document, offset + 1, bracket);
+ } else {
+ bracket = TextUtil.closingBrackets.IndexOf (ch);
+ if (bracket >= 0) {
+ result =
TextUtil.SearchMatchingBracketBackward (Document, offset - 1, bracket);
+ } else {
+ result = -1;
+ }
+ }
+ return result;
+ }
+
public override void OptionsChanged ()
{
DisposeGCs ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches