Skip to content

Commit 6ec820d

Browse files
committed
Move declarations closer to usage
1 parent 62f1bf1 commit 6ec820d

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

Project/Src/Actions/HomeEndActions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ public class Home : AbstractEditAction
1313
{
1414
public override void Execute(TextArea textArea)
1515
{
16-
LineSegment curLine;
1716
var newPos = textArea.Caret.Position;
1817
bool jumpedIntoFolding;
1918
do
2019
{
21-
curLine = textArea.Document.GetLineSegment(newPos.Y);
20+
var curLine = textArea.Document.GetLineSegment(newPos.Y);
2221

2322
if (TextUtilities.IsEmptyLine(textArea.Document, newPos.Y))
2423
{

Project/Src/Document/HighlightingStrategy/HighlightRuleSet.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ public HighlightRuleSet()
2525

2626
public HighlightRuleSet(XmlElement el)
2727
{
28-
XmlNodeList nodes;
29-
3028
if (el.Attributes["name"] != null)
3129
Name = el.Attributes["name"].InnerText;
3230

@@ -55,7 +53,7 @@ public HighlightRuleSet(XmlElement el)
5553
PrevMarkers = new LookupTable(!IgnoreCase);
5654
NextMarkers = new LookupTable(!IgnoreCase);
5755

58-
nodes = el.GetElementsByTagName("KeyWords");
56+
var nodes = el.GetElementsByTagName("KeyWords");
5957
foreach (XmlElement el2 in nodes)
6058
{
6159
var color = new HighlightColor(el2);

Project/Src/Document/Selection/SelectionManager.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ private void ClearWithoutUpdate()
266266
/// </remarks>
267267
public void ClearSelection()
268268
{
269-
Point mousepos;
270-
mousepos = textArea.mousepos;
269+
var mousepos = textArea.mousepos;
271270
// this is the most logical place to reset selection starting
272271
// positions because it is always called before a new selection
273272
selectFrom.first = selectFrom.where;

Project/Src/Gui/TextAreaMouseHandler.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,11 @@ private void OnMouseUp(object sender, MouseEventArgs e)
126126

127127
private void TextAreaClick(object sender, EventArgs e)
128128
{
129-
Point mousepos;
130-
mousepos = textArea.mousepos;
131-
132129
if (dodragdrop)
133130
return;
134131

132+
var mousepos = textArea.mousepos;
133+
135134
if (clickedOnSelectedText && textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y))
136135
{
137136
textArea.SelectionManager.ClearSelection();
@@ -201,8 +200,7 @@ private void TextAreaMouseMove(object sender, MouseEventArgs e)
201200

202201
private void ExtendSelectionToMouse()
203202
{
204-
Point mousepos;
205-
mousepos = textArea.mousepos;
203+
var mousepos = textArea.mousepos;
206204
var realmousepos = textArea.TextView.GetLogicalPosition(
207205
Math.Max(val1: 0, mousepos.X - textArea.TextView.DrawingPosition.X),
208206
mousepos.Y - textArea.TextView.DrawingPosition.Y);
@@ -259,8 +257,7 @@ private void ExtendSelectionToMouse()
259257

260258
private void DoubleClickSelectionExtend()
261259
{
262-
Point mousepos;
263-
mousepos = textArea.mousepos;
260+
var mousepos = textArea.mousepos;
264261

265262
textArea.SelectionManager.ClearSelection();
266263
if (textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y))
@@ -325,9 +322,8 @@ private void DoubleClickSelectionExtend()
325322

326323
private void OnMouseDown(object sender, MouseEventArgs e)
327324
{
328-
Point mousepos;
329325
textArea.mousepos = e.Location;
330-
mousepos = e.Location;
326+
var mousepos = e.Location;
331327

332328
if (dodragdrop)
333329
return;

0 commit comments

Comments
 (0)