diff options
Diffstat (limited to 'main/src/core/Mono.Texteditor/Mono.TextEditor/Document')
-rw-r--r-- | main/src/core/Mono.Texteditor/Mono.TextEditor/Document/EmacsWordFindStrategy.cs | 18 | ||||
-rw-r--r-- | main/src/core/Mono.Texteditor/Mono.TextEditor/Document/IWordFindStrategy.cs | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/EmacsWordFindStrategy.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/EmacsWordFindStrategy.cs index 06eb0fb1ca..7272c56432 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/EmacsWordFindStrategy.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/EmacsWordFindStrategy.cs @@ -34,11 +34,11 @@ namespace Mono.TextEditor { public class EmacsWordFindStrategy : WordFindStrategy {
- bool treat_;
+ bool includeUnderscore;
- public EmacsWordFindStrategy (bool treat_)
+ public EmacsWordFindStrategy (bool includeUnderscore = true)
{
- this.treat_ = treat_;
+ this.includeUnderscore = includeUnderscore;
}
int FindNextWordOffset (TextDocument doc, int offset, bool subword) @@ -46,11 +46,11 @@ namespace Mono.TextEditor if (offset + 1 >= doc.TextLength) return doc.TextLength; int result = offset + 1;
- CC previous = SW.GetCharacterClass (doc.GetCharAt (result), subword, treat_);
+ CC previous = SW.GetCharacterClass (doc.GetCharAt (result), subword, includeUnderscore);
bool inIndentifier = previous != CC.Unknown && previous != CC.Whitespace;
while (result < doc.TextLength) { char ch = doc.GetCharAt (result);
- CC current = SW.GetCharacterClass (ch, subword, treat_);
+ CC current = SW.GetCharacterClass (ch, subword, includeUnderscore);
//camelCase / PascalCase splitting
if (subword) {
@@ -61,7 +61,7 @@ namespace Mono.TextEditor } else if (current == CC.UppercaseLetter && previous != CC.UppercaseLetter) {
break;
} else if (current == CC.LowercaseLetter && previous == CC.UppercaseLetter && result - 2 > 0
- && SW.GetCharacterClass (doc.GetCharAt (result - 2), subword, treat_) != CC.LowercaseLetter)
+ && SW.GetCharacterClass (doc.GetCharAt (result - 2), subword, includeUnderscore) != CC.LowercaseLetter)
{
result--;
break;
@@ -90,11 +90,11 @@ namespace Mono.TextEditor if (offset <= 0) return 0; int result = offset - 1; - CC previous = SW.GetCharacterClass (doc.GetCharAt (result), subword, treat_);
+ CC previous = SW.GetCharacterClass (doc.GetCharAt (result), subword, includeUnderscore);
bool inIndentifier = previous != CC.Unknown && previous != CC.Whitespace;
while (result > 0) { char ch = doc.GetCharAt (result);
- CC current = SW.GetCharacterClass (ch, subword, treat_);
+ CC current = SW.GetCharacterClass (ch, subword, includeUnderscore);
//camelCase / PascalCase splitting
if (subword) {
@@ -107,7 +107,7 @@ namespace Mono.TextEditor } else if (current == CC.UppercaseLetter && previous != CC.UppercaseLetter) {
break;
} else if (current == CC.LowercaseLetter && previous == CC.UppercaseLetter && result + 2 < doc.TextLength
- && SW.GetCharacterClass (doc.GetCharAt (result + 2), subword, treat_) != CC.LowercaseLetter)
+ && SW.GetCharacterClass (doc.GetCharAt (result + 2), subword, includeUnderscore) != CC.LowercaseLetter)
{
result++;
break;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/IWordFindStrategy.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/IWordFindStrategy.cs index 0ebf5c8781..58d26955a7 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/IWordFindStrategy.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/IWordFindStrategy.cs @@ -56,7 +56,7 @@ namespace Mono.TextEditor return GetCharacterClass (ch, false, false); } - public static CharacterClass GetCharacterClass (char ch, bool subword, bool treat_) + public static CharacterClass GetCharacterClass (char ch, bool subword, bool includeUnderscore) { if (Char.IsWhiteSpace (ch)) return CharacterClass.Whitespace; @@ -70,7 +70,7 @@ namespace Mono.TextEditor else return CharacterClass.LowercaseLetter; } - if (!subword && treat_ && ch == '_') + if (!subword && includeUnderscore && ch == '_') return CharacterClass.IdentifierPart; return CharacterClass.Unknown; } |