From c3d863fdf165a42c0595673fdae51c9efe13f56d Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Fri, 6 Jul 2018 00:01:58 +0100 Subject: [PATCH] Comment unused variables --- Project/Src/Actions/CaretActions.cs | 2 +- Project/Src/Actions/MiscActions.cs | 6 +++--- .../FoldingStrategy/IndentFoldingStrategy.cs | 4 ++-- Project/Src/Document/TextUtilities.cs | 4 ++-- .../Src/Gui/InsightWindow/InsightWindow.cs | 6 +++--- Project/Src/Gui/TextAreaDragDropHandler.cs | 2 +- Project/Src/Gui/TextAreaMouseHandler.cs | 4 ++-- Project/Src/Gui/TextView.cs | 4 ++-- Project/Src/Util/AugmentableRedBlackTree.cs | 2 +- Project/Src/Util/LookupTable.cs | 2 +- Project/Src/Util/TipPainter.cs | 20 +++++++++---------- Test/DocumentTests.cs | 2 +- 12 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Project/Src/Actions/CaretActions.cs b/Project/Src/Actions/CaretActions.cs index dbd19c0..3d029ea 100644 --- a/Project/Src/Actions/CaretActions.cs +++ b/Project/Src/Actions/CaretActions.cs @@ -178,7 +178,7 @@ namespace ICSharpCode.TextEditor.Actions } else { - var line = textArea.Document.GetLineSegment(textArea.Caret.Position.Y); + //var line = textArea.Document.GetLineSegment(textArea.Caret.Position.Y); var prevWordStart = TextUtilities.FindPrevWordStart(textArea.Document, textArea.Caret.Offset); diff --git a/Project/Src/Actions/MiscActions.cs b/Project/Src/Actions/MiscActions.cs index fba7b3a..7a48f6c 100644 --- a/Project/Src/Actions/MiscActions.cs +++ b/Project/Src/Actions/MiscActions.cs @@ -192,7 +192,7 @@ namespace ICSharpCode.TextEditor.Actions // previous tab stop. It will stop at the beginning of the line. Also, the desired // column is updated to that column. var line = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset); - var startOfLine = textArea.Document.GetText(line.Offset, textArea.Caret.Offset - line.Offset); + //var startOfLine = textArea.Document.GetText(line.Offset, textArea.Caret.Offset - line.Offset); var tabIndent = textArea.Document.TextEditorProperties.IndentationSize; var currentColumn = textArea.Caret.Column; var remainder = currentColumn%tabIndent; @@ -263,7 +263,7 @@ namespace ICSharpCode.TextEditor.Actions continue; } - var lineText = document.GetText(line.Offset, line.Length); +// var lineText = document.GetText(line.Offset, line.Length); document.Insert(line.Offset, comment); } } @@ -537,7 +537,7 @@ namespace ICSharpCode.TextEditor.Actions if (curLineOffset == textArea.Caret.Offset) { var line = textArea.Document.GetLineSegment(curLineNr - 1); - var lastLine = curLineNr == textArea.Document.TotalNumberOfLines; +// var lastLine = curLineNr == textArea.Document.TotalNumberOfLines; var lineEndOffset = line.Offset + line.Length; var lineLength = line.Length; textArea.Document.Remove(lineEndOffset, curLineOffset - lineEndOffset); diff --git a/Project/Src/Document/FoldingStrategy/IndentFoldingStrategy.cs b/Project/Src/Document/FoldingStrategy/IndentFoldingStrategy.cs index 38fe83f..cbfa90f 100644 --- a/Project/Src/Document/FoldingStrategy/IndentFoldingStrategy.cs +++ b/Project/Src/Document/FoldingStrategy/IndentFoldingStrategy.cs @@ -18,8 +18,8 @@ namespace ICSharpCode.TextEditor.Document public List GenerateFoldMarkers(IDocument document, string fileName, object parseInformation) { var l = new List(); - var offsetStack = new Stack(); - var textStack = new Stack(); +// var offsetStack = new Stack(); +// var textStack = new Stack(); //int level = 0; //foreach (LineSegment segment in document.LineSegmentCollection) { // diff --git a/Project/Src/Document/TextUtilities.cs b/Project/Src/Document/TextUtilities.cs index dcb82e9..dd04fee 100644 --- a/Project/Src/Document/TextUtilities.cs +++ b/Project/Src/Document/TextUtilities.cs @@ -201,7 +201,7 @@ namespace ICSharpCode.TextEditor.Document // next word public static int FindNextWordStart(IDocument document, int offset) { - var originalOffset = offset; +// var originalOffset = offset; var line = document.GetLineSegmentForOffset(offset); var endPos = line.Offset + line.Length; // lets go to the end of the word, whitespace or operator @@ -221,7 +221,7 @@ namespace ICSharpCode.TextEditor.Document // to the start of the previous word public static int FindPrevWordStart(IDocument document, int offset) { - var originalOffset = offset; +// var originalOffset = offset; if (offset > 0) { var line = document.GetLineSegmentForOffset(offset); diff --git a/Project/Src/Gui/InsightWindow/InsightWindow.cs b/Project/Src/Gui/InsightWindow/InsightWindow.cs index 357952a..8f7fd06 100644 --- a/Project/Src/Gui/InsightWindow/InsightWindow.cs +++ b/Project/Src/Gui/InsightWindow/InsightWindow.cs @@ -85,9 +85,9 @@ namespace ICSharpCode.TextEditor.Gui.InsightWindow { // move the window under the caret (don't change the x position) var caretPos = control.ActiveTextAreaControl.Caret.Position; - var y = (1 + caretPos.Y)*control.ActiveTextAreaControl.TextArea.TextView.FontHeight - - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 - + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y; +// var y = (1 + caretPos.Y)*control.ActiveTextAreaControl.TextArea.TextView.FontHeight +// - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 +// + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y; var xpos = control.ActiveTextAreaControl.TextArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X); var ypos = (control.ActiveTextAreaControl.Document.GetVisibleLine(caretPos.Y) + 1)*control.ActiveTextAreaControl.TextArea.TextView.FontHeight diff --git a/Project/Src/Gui/TextAreaDragDropHandler.cs b/Project/Src/Gui/TextAreaDragDropHandler.cs index 8337a4d..e4694fb 100644 --- a/Project/Src/Gui/TextAreaDragDropHandler.cs +++ b/Project/Src/Gui/TextAreaDragDropHandler.cs @@ -82,7 +82,7 @@ namespace ICSharpCode.TextEditor protected void OnDragDrop(object sender, DragEventArgs e) { - var p = textArea.PointToClient(new Point(e.X, e.Y)); +// var p = textArea.PointToClient(new Point(e.X, e.Y)); if (e.Data.GetDataPresent(typeof(string))) { diff --git a/Project/Src/Gui/TextAreaMouseHandler.cs b/Project/Src/Gui/TextAreaMouseHandler.cs index 5794433..1b72b4d 100644 --- a/Project/Src/Gui/TextAreaMouseHandler.cs +++ b/Project/Src/Gui/TextAreaMouseHandler.cs @@ -206,7 +206,7 @@ namespace ICSharpCode.TextEditor var realmousepos = textArea.TextView.GetLogicalPosition( Math.Max(val1: 0, mousepos.X - textArea.TextView.DrawingPosition.X), mousepos.Y - textArea.TextView.DrawingPosition.Y); - var y = realmousepos.Y; +// var y = realmousepos.Y; realmousepos = textArea.Caret.ValidatePosition(realmousepos); var oldPos = textArea.Caret.Position; if (oldPos == realmousepos && textArea.SelectionManager.selectFrom.where != WhereFrom.Gutter) @@ -229,7 +229,7 @@ namespace ICSharpCode.TextEditor if (!minSelection.IsEmpty && textArea.SelectionManager.SelectionCollection.Count > 0 && textArea.SelectionManager.selectFrom.where == WhereFrom.TArea) { // Extend selection when selection was started with double-click - var selection = textArea.SelectionManager.SelectionCollection[index: 0]; +// var selection = textArea.SelectionManager.SelectionCollection[index: 0]; var min = textArea.SelectionManager.GreaterEqPos(minSelection, maxSelection) ? maxSelection : minSelection; var max = textArea.SelectionManager.GreaterEqPos(minSelection, maxSelection) ? minSelection : maxSelection; if (textArea.SelectionManager.GreaterEqPos(max, realmousepos) && textArea.SelectionManager.GreaterEqPos(realmousepos, min)) diff --git a/Project/Src/Gui/TextView.cs b/Project/Src/Gui/TextView.cs index 197df37..bc84981 100644 --- a/Project/Src/Gui/TextView.cs +++ b/Project/Src/Gui/TextView.cs @@ -117,7 +117,7 @@ namespace ICSharpCode.TextEditor if (rect.IntersectsWith(lineRectangle)) { - var fvl = textArea.Document.GetVisibleLine(FirstVisibleLine); +// var fvl = textArea.Document.GetVisibleLine(FirstVisibleLine); var currentLine = textArea.Document.GetFirstLogicalLine(textArea.Document.GetVisibleLine(FirstVisibleLine) + y); PaintDocumentLine(g, currentLine, lineRectangle); } @@ -976,7 +976,7 @@ namespace ICSharpCode.TextEditor } var column = 0; - var tabIndent = Document.TextEditorProperties.TabIndent; +// var tabIndent = Document.TextEditorProperties.TabIndent; float drawingPos; var g = textArea.CreateGraphics(); // if no folding is interesting diff --git a/Project/Src/Util/AugmentableRedBlackTree.cs b/Project/Src/Util/AugmentableRedBlackTree.cs index e406110..cf1a872 100644 --- a/Project/Src/Util/AugmentableRedBlackTree.cs +++ b/Project/Src/Util/AugmentableRedBlackTree.cs @@ -91,7 +91,7 @@ namespace ICSharpCode.TextEditor.Util CheckNodeProperties(root, parentNode: null, RED, blackCount: 0, ref blackCount); var nodeCount = 0; - foreach (var val in this) + foreach (var _ in this) nodeCount++; Debug.Assert(Count == nodeCount); } diff --git a/Project/Src/Util/LookupTable.cs b/Project/Src/Util/LookupTable.cs index 2301889..4daf565 100644 --- a/Project/Src/Util/LookupTable.cs +++ b/Project/Src/Util/LookupTable.cs @@ -91,7 +91,7 @@ namespace ICSharpCode.TextEditor.Util for (var i = 0; i < keyword.Length; ++i) { var index = keyword[i]%256; // index of curchar - var d = keyword[i] == '\\'; +// var d = keyword[i] == '\\'; next = next[index]; // get node to this index diff --git a/Project/Src/Util/TipPainter.cs b/Project/Src/Util/TipPainter.cs index 6490812..02bb6dc 100644 --- a/Project/Src/Util/TipPainter.cs +++ b/Project/Src/Util/TipPainter.cs @@ -137,11 +137,11 @@ namespace ICSharpCode.TextEditor.Util var borderRectangle = new Rectangle (Point.Empty, tipSize - new Size(width: 1, height: 1)); - var displayRectangle = new RectangleF - ( - HorizontalBorder, VerticalBorder, - tipSizeF.Width - HorizontalBorder*2, - tipSizeF.Height - VerticalBorder*2); +// var displayRectangle = new RectangleF +// ( +// HorizontalBorder, VerticalBorder, +// tipSizeF.Width - HorizontalBorder*2, +// tipSizeF.Height - VerticalBorder*2); // DrawRectangle draws from Left to Left + Width. A bug? :-/ graphics.DrawRectangle( @@ -189,11 +189,11 @@ namespace ICSharpCode.TextEditor.Util var borderRectangle = new Rectangle (Point.Empty, control.Size - new Size(width: 1, height: 1)); - var displayRectangle = new RectangleF - ( - HorizontalBorder, VerticalBorder, - tipSizeF.Width - HorizontalBorder*2, - tipSizeF.Height - VerticalBorder*2); +// var displayRectangle = new RectangleF +// ( +// HorizontalBorder, VerticalBorder, +// tipSizeF.Width - HorizontalBorder*2, +// tipSizeF.Height - VerticalBorder*2); // DrawRectangle draws from Left to Left + Width. A bug? :-/ graphics.DrawRectangle( diff --git a/Test/DocumentTests.cs b/Test/DocumentTests.cs index f11950c..0a0af8c 100644 --- a/Test/DocumentTests.cs +++ b/Test/DocumentTests.cs @@ -53,7 +53,7 @@ namespace ICSharpCode.TextEditor.Tests [Test] public void TestDocumentGenerationTest() { - var document = new DocumentFactory().CreateDocument(); + new DocumentFactory().CreateDocument(); } [Test]