diff --git a/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/AvalonEditUtility.cs b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/AvalonEditUtility.cs
new file mode 100644
index 0000000..9f461e0
--- /dev/null
+++ b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/AvalonEditUtility.cs
@@ -0,0 +1,34 @@
+using ICSharpCode.AvalonEdit;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ILEditor.Classes.AvalonEdit.LineNumberCommandMargin
+{
+ public static class AvalonEditUtility
+ {
+ public static void DeleteLine( TextEditor editor, int lineNumber)
+ {
+ var editorLine = editor.Document.GetLineByNumber(lineNumber);
+ // remove the line from AvalonEdit
+
+ if( editorLine.NextLine != null && editorLine.PreviousLine == null)
+ {
+ // has no previous but has next
+ editor.Document.Remove(editorLine.Offset, editorLine.NextLine.Offset - editorLine.Offset);
+ }
+ else if( editorLine.PreviousLine != null )
+ {
+ // has previous (Having a next either way doesn't matter)
+ editor.Document.Remove(editorLine.PreviousLine.EndOffset, editorLine.EndOffset - editorLine.PreviousLine.EndOffset);
+ }
+ else
+ {
+ // has no next or previous
+ editor.Document.Remove(editorLine); // this just clears contents of the line
+ }
+ }
+ }
+}
diff --git a/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineInfo.cs b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineInfo.cs
new file mode 100644
index 0000000..269d185
--- /dev/null
+++ b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineInfo.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ILEditor.Classes.AvalonEdit.LineNumberCommandMargin
+{
+ public class LineInfo
+ {
+ public int Number { get; set; }
+ public double LineHeight { get; set; }
+
+
+ }
+}
diff --git a/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplay.xaml b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplay.xaml
new file mode 100644
index 0000000..ebbe5a8
--- /dev/null
+++ b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplay.xaml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplay.xaml.cs b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplay.xaml.cs
new file mode 100644
index 0000000..3e4454b
--- /dev/null
+++ b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplay.xaml.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+
+namespace ILEditor.Classes.AvalonEdit.LineNumberCommandMargin
+{
+ ///
+ /// Interaction logic for LineNumberDisplay.xaml
+ ///
+ public partial class LineNumberDisplay : UserControl
+ {
+
+ #region Model DP
+
+ public static readonly DependencyProperty ModelProperty = DependencyProperty.Register("Model", typeof(LineNumberDisplayModel), typeof(LineNumberDisplay), new PropertyMetadata { PropertyChangedCallback = new PropertyChangedCallback( OnModelChanged) });
+
+ public LineNumberDisplayModel Model
+ {
+ get { return (LineNumberDisplayModel)this.GetValue(ModelProperty); }
+ set { this.SetValue(ModelProperty, value); }
+ }
+
+ private static void OnModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs args)
+ {
+ var ctrl = d as LineNumberDisplay;
+ ctrl.InitModel();
+ }
+
+ #endregion
+
+ public LineNumberDisplay()
+ {
+ InitializeComponent();
+
+ }
+
+
+ public void InitModel()
+ {
+ // hookup events and other things
+ var model = this.DataContext as LineNumberDisplayModel;
+
+ // different things can signal us to turn on command mode
+ model.OnSignalToTurnOnCommandMode += Model_OnSignalToTurnOnCommandMode;
+ }
+
+ private void Model_OnSignalToTurnOnCommandMode(object arg1, EventArgs arg2)
+ {
+ var model = this.DataContext as LineNumberDisplayModel;
+ model.IsCommandEntryVisible = true;
+ // focus the textbox
+ lineNumberCommandTextBox.Focus();
+ }
+
+ private void lineNumberTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
+ {
+ // clicked line number so go to command mode
+ var context = this.DataContext as LineNumberDisplayModel;
+ context.IsCommandEntryVisible = true;
+ lineNumberCommandTextBox.Focus();
+ }
+
+ private void lineNumberCommandTextBox_LostFocus(object sender, RoutedEventArgs e)
+ {
+ var context = this.DataContext as LineNumberDisplayModel;
+ // they may have entered a command that got rid of the line
+ if( context != null)
+ {
+ context.IsCommandEntryVisible = false;
+ }
+
+ }
+
+ private void lineNumberCommandTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
+ {
+ // clicked a command area so go to command mode
+ var context = this.DataContext as LineNumberDisplayModel;
+ context.IsCommandEntryVisible = true;
+ lineNumberCommandTextBox.Focus();
+ }
+
+ private void lineNumberCommandTextBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ var model = this.DataContext as LineNumberDisplayModel;
+ if( e.Key == Key.Return)
+ {
+ // signal command submitted
+ model.signalSubmitAllCommands();
+ }
+ }
+
+ private void lineNumberCommandTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
+ {
+ var model = this.DataContext as LineNumberDisplayModel;
+ //arrow keys only available on this event. They don't show up on KeyDown
+ if (e.Key == Key.Right &&
+ ( lineNumberCommandTextBox.Text.Length == 0 ||
+ lineNumberCommandTextBox.CaretIndex == lineNumberCommandTextBox.Text.Length - 1
+ )
+ )
+ {
+ // signal that we should move to avalonedit
+ model.IsCommandEntryVisible = false;
+ model.signalCommandModeArrowKeyShouldCauseCursorToBeOnAvalonEdit();// I bet we need to pass line number later
+ } else if( e.Key == Key.Up)
+ {
+ // signal that we should move up a line number command
+ model.IsCommandEntryVisible = false;
+ model.signalUpArrowKeyPressedInCommandTextBox();
+ } else if( e.Key == Key.Down)
+ {
+ // signal that we should move down a line number command
+ model.IsCommandEntryVisible = false;
+ model.signalDownArrowKeyPressedInCommandTextBox();
+ }
+ }
+ }
+
+
+
+}
diff --git a/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplayModel.cs b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplayModel.cs
new file mode 100644
index 0000000..dcf0009
--- /dev/null
+++ b/ILEditor/Classes/AvalonEdit.LineNumberCommandMargin/LineNumberDisplayModel.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ILEditor.Classes.AvalonEdit.LineNumberCommandMargin
+{
+ public class LineNumberDisplayModel : WPFHelpers.ViewModelBase
+ {
+
+ public event Action