Browse Source

AvalonEdit: Fixed bug in GetIndentation that could mess up text when pressing Enter.

Fixed exception when opening a file for which no syntax highlighting is available.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3940 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
b6cd6d16b0
  1. 12
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditViewContent.cs
  2. 6
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/TextUtilities.cs

12
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditViewContent.cs

@ -68,12 +68,14 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -68,12 +68,14 @@ namespace ICSharpCode.AvalonEdit.AddIn
void LoadFormatter()
{
const string formatingStrategyPath = "/AddIns/DefaultTextEditor/Formatter";
const string formatingStrategyPath = "/AddIns/DefaultTextEditor/Formatter";
string formatterPath = formatingStrategyPath + "/" + codeEditor.SyntaxHighlighting.Name;
var formatter = AddInTree.BuildItems<IFormattingStrategy>(formatterPath, this, false);
if (formatter != null && formatter.Count > 0) {
codeEditor.FormattingStrategy = formatter[0];
if (codeEditor.SyntaxHighlighting != null) {
string formatterPath = formatingStrategyPath + "/" + codeEditor.SyntaxHighlighting.Name;
var formatter = AddInTree.BuildItems<IFormattingStrategy>(formatterPath, this, false);
if (formatter != null && formatter.Count > 0) {
codeEditor.FormattingStrategy = formatter[0];
}
}
}

6
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/TextUtilities.cs

@ -65,9 +65,9 @@ namespace ICSharpCode.AvalonEdit.Utils @@ -65,9 +65,9 @@ namespace ICSharpCode.AvalonEdit.Utils
{
if (textSource == null)
throw new ArgumentNullException("textSource");
int pos = offset;
while (pos < textSource.TextLength) {
char c = textSource.GetCharAt(pos++);
int pos;
for (pos = offset; pos < textSource.TextLength; pos++) {
char c = textSource.GetCharAt(pos);
if (c != ' ' && c != '\t')
break;
}

Loading…
Cancel
Save