Skip to content

Commit

Permalink
Move declarations closer to usage
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Jul 6, 2018
1 parent 62f1bf1 commit 6ec820d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
3 changes: 1 addition & 2 deletions Project/Src/Actions/HomeEndActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ public class Home : AbstractEditAction
{
public override void Execute(TextArea textArea)
{
LineSegment curLine;
var newPos = textArea.Caret.Position;
bool jumpedIntoFolding;
do
{
curLine = textArea.Document.GetLineSegment(newPos.Y);
var curLine = textArea.Document.GetLineSegment(newPos.Y);

if (TextUtilities.IsEmptyLine(textArea.Document, newPos.Y))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public HighlightRuleSet()

public HighlightRuleSet(XmlElement el)
{
XmlNodeList nodes;

if (el.Attributes["name"] != null)
Name = el.Attributes["name"].InnerText;

Expand Down Expand Up @@ -55,7 +53,7 @@ public HighlightRuleSet(XmlElement el)
PrevMarkers = new LookupTable(!IgnoreCase);
NextMarkers = new LookupTable(!IgnoreCase);

nodes = el.GetElementsByTagName("KeyWords");
var nodes = el.GetElementsByTagName("KeyWords");
foreach (XmlElement el2 in nodes)
{
var color = new HighlightColor(el2);
Expand Down
3 changes: 1 addition & 2 deletions Project/Src/Document/Selection/SelectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ private void ClearWithoutUpdate()
/// </remarks>
public void ClearSelection()
{
Point mousepos;
mousepos = textArea.mousepos;
var mousepos = textArea.mousepos;
// this is the most logical place to reset selection starting
// positions because it is always called before a new selection
selectFrom.first = selectFrom.where;
Expand Down
14 changes: 5 additions & 9 deletions Project/Src/Gui/TextAreaMouseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,11 @@ private void OnMouseUp(object sender, MouseEventArgs e)

private void TextAreaClick(object sender, EventArgs e)
{
Point mousepos;
mousepos = textArea.mousepos;

if (dodragdrop)
return;

var mousepos = textArea.mousepos;

if (clickedOnSelectedText && textArea.TextView.DrawingPosition.Contains(mousepos.X, mousepos.Y))
{
textArea.SelectionManager.ClearSelection();
Expand Down Expand Up @@ -201,8 +200,7 @@ private void TextAreaMouseMove(object sender, MouseEventArgs e)

private void ExtendSelectionToMouse()
{
Point mousepos;
mousepos = textArea.mousepos;
var mousepos = textArea.mousepos;
var realmousepos = textArea.TextView.GetLogicalPosition(
Math.Max(val1: 0, mousepos.X - textArea.TextView.DrawingPosition.X),
mousepos.Y - textArea.TextView.DrawingPosition.Y);
Expand Down Expand Up @@ -259,8 +257,7 @@ private void ExtendSelectionToMouse()

private void DoubleClickSelectionExtend()
{
Point mousepos;
mousepos = textArea.mousepos;
var mousepos = textArea.mousepos;

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

private void OnMouseDown(object sender, MouseEventArgs e)
{
Point mousepos;
textArea.mousepos = e.Location;
mousepos = e.Location;
var mousepos = e.Location;

if (dodragdrop)
return;
Expand Down

0 comments on commit 6ec820d

Please sign in to comment.