mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 13:28:41 +00:00
ASM window now scrolls to approximately the correct place for current line.
This commit is contained in:
parent
c7a239f1c3
commit
45f3002493
2 changed files with 15 additions and 1 deletions
|
|
@ -30,7 +30,7 @@
|
|||
</Button>-->
|
||||
<Rectangle Width="8" />
|
||||
</ToolBar>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer Name="ASMScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<TextBlock Name="tblkSource">
|
||||
<TextBlock.ContextMenu>
|
||||
<ContextMenu>
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ namespace Cosmos.VS.Windows
|
|||
List<string> xLabelPrefixes = new List<string>();
|
||||
bool foundMETHOD_Prefix = false;
|
||||
bool foundMethodName = false;
|
||||
int mCurrentLineNumber = 0;
|
||||
foreach (var xLine in mLines)
|
||||
{
|
||||
string xDisplayLine = xLine.ToString();
|
||||
|
|
@ -186,6 +187,11 @@ namespace Cosmos.VS.Windows
|
|||
if (tblkSource.Inlines.Count > 0)
|
||||
{
|
||||
tblkSource.Inlines.Add(new LineBreak());
|
||||
if (!foundCurrentLine)
|
||||
{
|
||||
mCurrentLineNumber++;
|
||||
}
|
||||
|
||||
mCode.AppendLine();
|
||||
}
|
||||
}
|
||||
|
|
@ -257,11 +263,19 @@ namespace Cosmos.VS.Windows
|
|||
xRun.Foreground = Brushes.HotPink;
|
||||
}
|
||||
|
||||
if (!foundCurrentLine)
|
||||
{
|
||||
mCurrentLineNumber++;
|
||||
}
|
||||
tblkSource.Inlines.Add(xRun);
|
||||
tblkSource.Inlines.Add(new LineBreak());
|
||||
|
||||
mCode.AppendLine(xDisplayLine);
|
||||
}
|
||||
//EdMan196: This line of code was worked out by trial and error.
|
||||
//If you change it proper testing/thinking, you will have to add RIP to your name.
|
||||
double offset = mCurrentLineNumber * ((tblkSource.FontSize * tblkSource.FontFamily.LineSpacing) - 2.1);
|
||||
ASMScrollViewer.ScrollToVerticalOffset(offset);
|
||||
}
|
||||
|
||||
protected void OnASMCodeTextMouseUp(object aSender, System.Windows.Input.MouseButtonEventArgs aArgs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue