diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/Indentation.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/Indentation.cs index bbd4b7d1e5..342f9d1228 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/Indentation.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/Indentation.cs @@ -85,7 +85,9 @@ namespace CSharpBinding.FormattingStrategy public void Step(IDocumentAccessor doc, IndentationSettings set) { - string line = doc.Text.TrimStart(); + string line = doc.Text; + if (line.Length == 0) return; // leave empty lines empty + line = line.TrimStart(); StringBuilder indent = new StringBuilder(); if (line.Length == 0) { @@ -273,7 +275,7 @@ namespace CSharpBinding.FormattingStrategy if (startInString) return; if (startInComment && line[0] != '*') return; - if (doc.Text.StartsWith("//\t")) + if (doc.Text.StartsWith("//\t") || doc.Text == "//") return; if (line[0] == '}') { @@ -306,7 +308,7 @@ namespace CSharpBinding.FormattingStrategy if (doc.ReadOnly) { // We can't change the current line, but we should accept the existing - // indentation if possible (so if the current statement is not a multiline + // indentation if possible (=if the current statement is not a multiline // statement). if (!oldBlock.Continuation && !oldBlock.OneLineBlock && oldBlock.StartLine == block.StartLine && diff --git a/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs b/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs index 3da99e2654..c329b458d3 100644 --- a/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs +++ b/src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs @@ -141,6 +141,11 @@ namespace ICSharpCode.SharpDevelop.Gui ((ExtTreeNode)e.Node).Expanding(); } SortNodes(e.Node); + if (e.Node.Nodes.Count == 0) { + // when the node's subnodes have been removed by Expanding, AfterExpand is not called + inRefresh = false; + EndUpdate(); + } } protected override void OnAfterExpand(TreeViewEventArgs e)