diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
index 326558eeb7..54425a9194 100644
--- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
+++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj
@@ -595,6 +595,9 @@
LuaWriterColorConfig.cs
+
+ Component
+
Component
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.Designer.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.Designer.cs
index 17f7d19fc3..58bfccc0a1 100644
--- a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.Designer.cs
+++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.Designer.cs
@@ -59,12 +59,12 @@
this.startWithEmptyScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MessageLabel = new System.Windows.Forms.Label();
- this.AutoCompleteView = new System.Windows.Forms.ListView();
- this.Suggestion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.PositionLabel = new System.Windows.Forms.Label();
this.ZoomLabel = new System.Windows.Forms.Label();
this.LuaText = new BizHawk.Client.EmuHawk.LuaWriterBox();
- this.LuaLineTextBox = new System.Windows.Forms.RichTextBox();
+ this.LuaLineNumbersRtb = new SyncTextBox();
+ this.AutoCompleteView = new System.Windows.Forms.ListView();
+ this.Suggestion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
@@ -83,7 +83,7 @@
this.configToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(846, 24);
+ this.menuStrip1.Size = new System.Drawing.Size(1184, 24);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
@@ -306,38 +306,12 @@
//
this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MessageLabel.AutoSize = true;
- this.MessageLabel.Location = new System.Drawing.Point(15, 484);
+ this.MessageLabel.Location = new System.Drawing.Point(15, 642);
this.MessageLabel.Name = "MessageLabel";
this.MessageLabel.Size = new System.Drawing.Size(91, 13);
this.MessageLabel.TabIndex = 2;
this.MessageLabel.Text = " ";
//
- // AutoCompleteView
- //
- this.AutoCompleteView.Activation = System.Windows.Forms.ItemActivation.OneClick;
- this.AutoCompleteView.AllowColumnReorder = true;
- this.AutoCompleteView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.AutoCompleteView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
- this.Suggestion});
- this.AutoCompleteView.FullRowSelect = true;
- this.AutoCompleteView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
- this.AutoCompleteView.HideSelection = false;
- this.AutoCompleteView.HoverSelection = true;
- this.AutoCompleteView.Location = new System.Drawing.Point(696, 382);
- this.AutoCompleteView.MultiSelect = false;
- this.AutoCompleteView.Name = "AutoCompleteView";
- this.AutoCompleteView.Size = new System.Drawing.Size(121, 97);
- this.AutoCompleteView.TabIndex = 3;
- this.AutoCompleteView.UseCompatibleStateImageBehavior = false;
- this.AutoCompleteView.View = System.Windows.Forms.View.Details;
- this.AutoCompleteView.Visible = false;
- this.AutoCompleteView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.AutoComplete_KeyDown);
- this.AutoCompleteView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.AutoCompleteView_MouseDoubleClick);
- //
- // Suggestion
- //
- this.Suggestion.Width = 114;
- //
// PositionLabel
//
this.PositionLabel.AutoSize = true;
@@ -363,48 +337,76 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.LuaText.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.LuaText.Buddy = this.LuaLineNumbersRtb;
this.LuaText.EnableAutoDragDrop = true;
- this.LuaText.Location = new System.Drawing.Point(63, 50);
+ this.LuaText.Location = new System.Drawing.Point(58, 46);
this.LuaText.Name = "LuaText";
- this.LuaText.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
- this.LuaText.Size = new System.Drawing.Size(768, 429);
+ this.LuaText.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical;
+ this.LuaText.Size = new System.Drawing.Size(1126, 609);
this.LuaText.TabIndex = 0;
this.LuaText.Text = "";
this.LuaText.WordWrap = false;
this.LuaText.SelectionChanged += new System.EventHandler(this.LuaText_SelectionChanged);
- this.LuaText.VScroll += new System.EventHandler(this.LuaText_VScroll);
this.LuaText.TextChanged += new System.EventHandler(this.LuaText_TextChanged);
this.LuaText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.LuaText_KeyDown);
this.LuaText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.LuaText_KeyUp);
this.LuaText.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.LuaText_PreviewKeyDown);
//
- // LuaLineTextBox
+ // LuaLineNumbersRtb
//
- this.LuaLineTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.LuaLineTextBox.BackColor = System.Drawing.SystemColors.ScrollBar;
- this.LuaLineTextBox.Location = new System.Drawing.Point(0, 50);
- this.LuaLineTextBox.Name = "LuaLineTextBox";
- this.LuaLineTextBox.ReadOnly = true;
- this.LuaLineTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
- this.LuaLineTextBox.Size = new System.Drawing.Size(60, 429);
- this.LuaLineTextBox.TabIndex = 6;
- this.LuaLineTextBox.Text = "";
- this.LuaLineTextBox.Visible = false;
+ this.LuaLineNumbersRtb.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.LuaLineNumbersRtb.BackColor = System.Drawing.SystemColors.ButtonShadow;
+ this.LuaLineNumbersRtb.Buddy = this.LuaText;
+ this.LuaLineNumbersRtb.Location = new System.Drawing.Point(0, 46);
+ this.LuaLineNumbersRtb.Name = "LuaLineNumbersRtb";
+ this.LuaLineNumbersRtb.ReadOnly = true;
+ this.LuaLineNumbersRtb.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical;
+ this.LuaLineNumbersRtb.Size = new System.Drawing.Size(1184, 609);
+ this.LuaLineNumbersRtb.TabIndex = 7;
+ this.LuaLineNumbersRtb.Text = "";
+ //
+ // AutoCompleteView
+ //
+ this.AutoCompleteView.Activation = System.Windows.Forms.ItemActivation.OneClick;
+ this.AutoCompleteView.AllowColumnReorder = true;
+ this.AutoCompleteView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.Suggestion});
+ this.AutoCompleteView.FullRowSelect = true;
+ this.AutoCompleteView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
+ this.AutoCompleteView.HideSelection = false;
+ this.AutoCompleteView.HoverSelection = true;
+ this.AutoCompleteView.Location = new System.Drawing.Point(208, 153);
+ this.AutoCompleteView.MultiSelect = false;
+ this.AutoCompleteView.Name = "AutoCompleteView";
+ this.AutoCompleteView.Scrollable = false;
+ this.AutoCompleteView.Size = new System.Drawing.Size(150, 182);
+ this.AutoCompleteView.TabIndex = 3;
+ this.AutoCompleteView.UseCompatibleStateImageBehavior = false;
+ this.AutoCompleteView.View = System.Windows.Forms.View.Details;
+ this.AutoCompleteView.Visible = false;
+ this.AutoCompleteView.SelectedIndexChanged += new System.EventHandler(this.AutoCompleteView_SelectedIndexChanged);
+ this.AutoCompleteView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.AutoComplete_KeyDown);
+ this.AutoCompleteView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.AutoCompleteView_MouseDoubleClick);
+ //
+ // Suggestion
+ //
+ this.Suggestion.Width = 100;
//
// LuaWriter
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(846, 501);
- this.Controls.Add(this.LuaLineTextBox);
+ this.ClientSize = new System.Drawing.Size(1184, 659);
this.Controls.Add(this.AutoCompleteView);
+ this.Controls.Add(this.LuaText);
+ this.Controls.Add(this.menuStrip1);
+ this.Controls.Add(this.LuaLineNumbersRtb);
this.Controls.Add(this.ZoomLabel);
this.Controls.Add(this.PositionLabel);
this.Controls.Add(this.MessageLabel);
- this.Controls.Add(this.LuaText);
- this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "LuaWriter";
@@ -435,7 +437,6 @@
private System.Windows.Forms.ToolStripMenuItem configToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fontToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem syntaxHighlightingToolStripMenuItem;
- private System.Windows.Forms.ListView AutoCompleteView;
private System.Windows.Forms.Label PositionLabel;
private System.Windows.Forms.Label ZoomLabel;
private System.Windows.Forms.ToolStripMenuItem restoreSettingsToolStripMenuItem;
@@ -455,8 +456,9 @@
private System.Windows.Forms.ToolStripMenuItem startWithEmptyScriptToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem backgroundColorToolStripMenuItem;
- private System.Windows.Forms.ColumnHeader Suggestion;
- private System.Windows.Forms.RichTextBox LuaLineTextBox;
private System.Windows.Forms.ToolStripMenuItem lineNumbersToolStripMenuItem;
+ private SyncTextBox LuaLineNumbersRtb;
+ private System.Windows.Forms.ListView AutoCompleteView;
+ private System.Windows.Forms.ColumnHeader Suggestion;
}
}
\ No newline at end of file
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs
index 5616315201..9b0cb7e2d9 100644
--- a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs
+++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs
@@ -41,11 +41,7 @@ namespace BizHawk.Client.EmuHawk
private bool hasChanged;
private bool ProcessingText;
- private bool isFirst;
- private bool DisableEvent;
private int lastLineofText;
- private int lineIndex;
- private int previousFirstVisibleChar;
private readonly char[] Symbols = { '+', '-', '*', '/', '%', '^', '#', '=', '<', '>', '(', ')', '{', '}', '[', ']', ';', ':', ',', '.' };
private List pos = new List();
@@ -54,7 +50,6 @@ namespace BizHawk.Client.EmuHawk
public LuaWriter(LuaConsole owner)
{
InitializeComponent();
- isFirst = true;
_owner = owner;
LuaText.MouseWheel += LuaText_MouseWheel;
lineNumbersToolStripMenuItem.Checked = Global.Config.LuaShowLineNumbers;
@@ -76,19 +71,8 @@ namespace BizHawk.Client.EmuHawk
ZoomLabel.Text = string.Format("Zoom: {0:0}%", Zoom);
}
- else
- {
-
- //UpdateLineTextBox();
- }
-
}
-
- private void LuaText_VScroll(object sender, EventArgs e)
- {
- //UpdateLineTextBox();
- }
-
+
private void timer_Tick(object sender, EventArgs e)
{
if (!hasChanged)
@@ -125,8 +109,6 @@ namespace BizHawk.Client.EmuHawk
ProcessingText = false;
LuaText.InhibitPaint = false;
LuaText.Refresh();
- isFirst = false;
- ShowLuaLineNumbersTextBox();
}
private void AddNumbers()
@@ -477,7 +459,7 @@ namespace BizHawk.Client.EmuHawk
private void LoadFont()
{
LuaText.Font = new Font(Global.Config.LuaWriterFont, Global.Config.LuaWriterFontSize);
- LuaLineTextBox.Font = new Font(Global.Config.LuaWriterFont, Global.Config.LuaWriterFontSize);
+ LuaLineNumbersRtb.Font = new Font(Global.Config.LuaWriterFont, Global.Config.LuaWriterFontSize);
}
private void LuaWriter_Load(object sender, EventArgs e)
@@ -640,7 +622,7 @@ namespace BizHawk.Client.EmuHawk
private void LuaText_TextChanged(object sender, EventArgs e)
{
-
+ ShowLuaLineNumbersTextBox();
HasTextChanged();
}
@@ -682,9 +664,11 @@ namespace BizHawk.Client.EmuHawk
private void AutoComplete_KeyDown(object sender, KeyEventArgs e)
{
+ int start = LuaText.SelectionStart;
if (e.KeyCode == Keys.Escape || e.KeyCode == Keys.Back)
{
AutoCompleteView.Visible = false;
+ LuaText.Focus();
}
else if (e.KeyCode == Keys.Enter)
@@ -695,8 +679,8 @@ namespace BizHawk.Client.EmuHawk
else if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
{
AutoCompleteView.Visible = false;
+ LuaText.Focus();
e.SuppressKeyPress = true;
- int start = LuaText.SelectionStart;
String letter = e.KeyCode.ToString();
if (!e.Shift)
{
@@ -704,10 +688,33 @@ namespace BizHawk.Client.EmuHawk
}
LuaText.Text = LuaText.Text.Insert(start, letter);
LuaText.Select(start + 1, 0);
-
}
}
+ private void ResizeAutoComplete()
+ {
+ if (AutoCompleteView.Items.Count != 0)
+ {
+ AutoCompleteView.Height = AutoCompleteView.Items.Count * 20;
+
+ int longestItem = AutoCompleteView.Items[0].Text.Length;
+ foreach (ListViewItem item in AutoCompleteView.Items)
+ {
+ if (item.Text.Length > longestItem)
+ {
+ longestItem = item.Text.Length;
+ }
+ }
+ AutoCompleteView.Width = longestItem * 5 + 20;
+ AutoCompleteView.Columns[0].Width = longestItem * 5 + 20;
+ AutoCompleteView.Visible = true;
+ }
+ else
+ {
+ AutoCompleteView.Visible = false;
+ }
+ }
+
private void LuaText_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
@@ -737,8 +744,7 @@ namespace BizHawk.Client.EmuHawk
AutoCompleteView.Items.Add(item);
}
// Show window after it has been positioned and set up
-
- AutoCompleteView.Visible = true;
+ ResizeAutoComplete();
}
}
@@ -760,21 +766,31 @@ namespace BizHawk.Client.EmuHawk
{
try
{
- if (LuaText.Lines[linenumber].Substring(0 + tabs, Word.Length) == Word)
+ string line = LuaText.Lines[linenumber];
+ //string subString = line.Substring(0 + tabs, Word.Length);
+ if ((Word.Length + tabs) <= line.Length)
{
- string str = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr + "\t\n" + tabsStr + "end");
- LuaText.Text = str;
- LuaText.Select(LuaText.GetFirstCharIndexFromLine(linenumber + 1) + 1 + tabs, 0);
- e.SuppressKeyPress = true;
- return;
+ if (line.Substring(0 + tabs, Word.Length) == Word)
+ {
+ string str = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr + "\t\n" + tabsStr + "end");
+ LuaText.Text = str;
+ LuaText.Select(LuaText.GetFirstCharIndexFromLine(linenumber + 1) + 1 + tabs, 0);
+ e.SuppressKeyPress = true;
+ return;
+ }
}
}
catch { }
}
- string tempStr = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr);
- LuaText.Text = tempStr;
+ // string tempStr = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr);
+ LuaText.Text = LuaText.Text.Insert(LuaText.SelectionStart, "\n" + tabsStr);
+ //tempStr;
+ LuaLineNumbersRtb.Select(LuaLineNumbersRtb.GetFirstCharIndexFromLine(linenumber + 1), 0);
+ LuaLineNumbersRtb.ScrollToCaret();
LuaText.Select(LuaText.GetFirstCharIndexFromLine(linenumber + 1) + tabs, 0);
+ LuaText.ScrollToCaret();
+
e.SuppressKeyPress = true;
}
@@ -821,7 +837,7 @@ namespace BizHawk.Client.EmuHawk
AutoCompleteView.Items.Add(item);
}
}
- AutoCompleteView.Visible = true;
+ ResizeAutoComplete();
}
else
{
@@ -838,11 +854,10 @@ namespace BizHawk.Client.EmuHawk
AutoCompleteView.Items.Add(item);
}
}
- AutoCompleteView.Visible = true;
+ ResizeAutoComplete();
}
}
}
-
}
private string CurrentWord()
@@ -896,7 +911,7 @@ namespace BizHawk.Client.EmuHawk
ListView.SelectedIndexCollection indexes = AutoCompleteView.SelectedIndices;
if (indexes.Count > 0)
{
-
+ LuaText.Focus();
string str = AutoCompleteView.Items[indexes[0]].Text;
int start = LuaText.SelectionStart;
@@ -920,11 +935,7 @@ namespace BizHawk.Client.EmuHawk
private void LuaText_SelectionChanged(object sender, EventArgs e)
{
- if (!DisableEvent && Global.Config.LuaShowLineNumbers && !isFirst)
- {
- UpdateLineNumber();
- ShowLuaLineNumbersTextBox();
- }
+ UpdateLineNumber();
}
private void UpdateLineNumber()
@@ -941,46 +952,30 @@ namespace BizHawk.Client.EmuHawk
private void UpdateLineTextBox()
{
- DisableEvent = true;
- int currentLocation = LuaText.SelectionStart;
- int firstVisibleChar = LuaText.GetCharIndexFromPosition(new Point(0,0));
- LuaText.Select(firstVisibleChar, 0);
-
-
- if (lastLineofText != LuaText.GetLineFromCharIndex(LuaText.TextLength) || previousFirstVisibleChar != LuaText.GetCharIndexFromPosition(new Point(0, 0)))
+ if (lastLineofText != LuaText.GetLineFromCharIndex(LuaText.TextLength))
{
- previousFirstVisibleChar = firstVisibleChar;
lastLineofText = LuaText.GetLineFromCharIndex(LuaText.TextLength);
- lineIndex = LuaText.GetLineFromCharIndex(firstVisibleChar);
- if (LuaText.GetLineFromCharIndex(currentLocation) == lastLineofText)
- {
- lineIndex++;
- }
-
- LuaLineTextBox.Text = String.Empty;
- for (int i = lineIndex + 1; i <= LuaText.GetLineFromCharIndex(LuaText.TextLength) + 1; i++)
+ LuaLineNumbersRtb.Text = String.Empty;
+ for (int i = 1; i <= LuaText.GetLineFromCharIndex(LuaText.TextLength) + 1; i++)
{
if (i < 10)
{
- LuaLineTextBox.Text += "00" + i;
+ LuaLineNumbersRtb.Text += "00" + i;
}
else if (i >= 10 && i < 100)
{
- LuaLineTextBox.Text += "0" + i;
+ LuaLineNumbersRtb.Text += "0" + i;
}
else
{
- LuaLineTextBox.Text += i;
+ LuaLineNumbersRtb.Text += i;
}
if (i != LuaText.GetLineFromCharIndex(LuaText.TextLength) + 1)
{
- LuaLineTextBox.Text += "\n";
+ LuaLineNumbersRtb.Text += "\n";
}
}
-
}
- LuaText.Select(currentLocation, 0);
- DisableEvent = false;
}
private void LuaText_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
@@ -1146,11 +1141,25 @@ namespace BizHawk.Client.EmuHawk
private void ShowLuaLineNumbersTextBox()
{
- LuaLineTextBox.Visible = Global.Config.LuaShowLineNumbers ;
- if (LuaLineTextBox.Visible)
+ LuaLineNumbersRtb.Visible = Global.Config.LuaShowLineNumbers;
+ if (LuaLineNumbersRtb.Visible )
{
UpdateLineTextBox();
}
+
+
+
+
+ }
+
+ private void AutoCompleteView_SelectedIndexChanged(object sender, EventArgs e)
+ {
+
+ }
+
+ private void syncTextBox1_TextChanged(object sender, EventArgs e)
+ {
+
}
}
}
\ No newline at end of file
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.resx b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.resx
index 1afba62822..035da136a8 100644
--- a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.resx
+++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.resx
@@ -123,6 +123,9 @@
97, 17
+
+ 70
+
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriterBox.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriterBox.cs
index 11faa78fb5..8ba822e16e 100644
--- a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriterBox.cs
+++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriterBox.cs
@@ -3,7 +3,7 @@ using System.Drawing;
namespace BizHawk.Client.EmuHawk
{
- class LuaWriterBox : RichTextBox
+ class LuaWriterBox : SyncTextBox
{
public bool InhibitPaint = false;
diff --git a/BizHawk.Client.EmuHawk/tools/Lua/SyncTextBox.cs b/BizHawk.Client.EmuHawk/tools/Lua/SyncTextBox.cs
new file mode 100644
index 0000000000..e39fdd1b7b
--- /dev/null
+++ b/BizHawk.Client.EmuHawk/tools/Lua/SyncTextBox.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+
+class SyncTextBox : RichTextBox
+{
+ public SyncTextBox()
+ {
+ this.Multiline = true;
+ this.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
+
+ }
+ public Control Buddy { get; set; }
+
+ private static bool scrolling; // In case buddy tries to scroll us
+ protected override void WndProc(ref Message m)
+ {
+ base.WndProc(ref m);
+ // Trap WM_VSCROLL message and pass to buddy
+ if ((m.Msg == 0x115 || m.Msg == 0x20a) && !scrolling && Buddy != null && Buddy.IsHandleCreated)
+ {
+ scrolling = true;
+ SendMessage(Buddy.Handle, m.Msg, m.WParam, m.LParam);
+ scrolling = false;
+ }
+ }
+ [DllImport("user32.dll", CharSet = CharSet.Auto)]
+ private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
+}
\ No newline at end of file