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. 2
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditViewContent.cs
  2. 6
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/TextUtilities.cs

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

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

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

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

Loading…
Cancel
Save