mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
Fix for display while tracing
This commit is contained in:
parent
2f2deccfbd
commit
bdd43929df
1 changed files with 19 additions and 25 deletions
|
|
@ -126,32 +126,28 @@ namespace Cosmos.Build.Windows {
|
||||||
var xPara = (Paragraph)fdsvSource.Document.Blocks.FirstBlock;
|
var xPara = (Paragraph)fdsvSource.Document.Blocks.FirstBlock;
|
||||||
var xSelectedLine = mLines[aLine];
|
var xSelectedLine = mLines[aLine];
|
||||||
string xText = xSelectedLine.Text;
|
string xText = xSelectedLine.Text;
|
||||||
|
// aLength = -1 means to end
|
||||||
if (aLength == -1) {
|
if (aLength == -1) {
|
||||||
aLength = xText.Length - aColBegin;
|
aLength = xText.Length - aColBegin;
|
||||||
}
|
}
|
||||||
|
// If not begin at col 0, then we need to leave some deselected area
|
||||||
if (aColBegin > 0) {
|
if (aColBegin > 0) {
|
||||||
var xRunLeft = new Run(xText.Substring(0,
|
var xRunLeft = new Run(xText.Substring(0, aColBegin));
|
||||||
aColBegin - 1));
|
|
||||||
xRunLeft.FontFamily = mFont;
|
xRunLeft.FontFamily = mFont;
|
||||||
xPara.Inlines.InsertBefore(xSelectedLine,
|
xPara.Inlines.InsertBefore(xSelectedLine, xRunLeft);
|
||||||
xRunLeft);
|
|
||||||
}
|
}
|
||||||
|
// Selected portion
|
||||||
xRunSelected = new Run(xText.Substring(aColBegin,
|
xRunSelected = new Run(xText.Substring(aColBegin, aLength));
|
||||||
aLength));
|
|
||||||
xRunSelected.FontFamily = mFont;
|
xRunSelected.FontFamily = mFont;
|
||||||
xRunSelected.Background = Brushes.Red;
|
xRunSelected.Background = Brushes.Red;
|
||||||
xPara.Inlines.InsertBefore(xSelectedLine,
|
xPara.Inlines.InsertBefore(xSelectedLine, xRunSelected);
|
||||||
xRunSelected);
|
// Unselected on right if there is some
|
||||||
|
|
||||||
if (aColBegin + aLength < xText.Length) {
|
if (aColBegin + aLength < xText.Length) {
|
||||||
var xRunRight = new Run(xText.Substring(aColBegin + aLength));
|
var xRunRight = new Run(xText.Substring(aColBegin + aLength));
|
||||||
xRunRight.FontFamily = mFont;
|
xRunRight.FontFamily = mFont;
|
||||||
xPara.Inlines.InsertBefore(xSelectedLine,
|
xPara.Inlines.InsertBefore(xSelectedLine, xRunRight);
|
||||||
xRunRight);
|
|
||||||
}
|
}
|
||||||
|
// Remove the old line
|
||||||
xPara.Inlines.Remove(xSelectedLine);
|
xPara.Inlines.Remove(xSelectedLine);
|
||||||
}
|
}
|
||||||
return xRunSelected;
|
return xRunSelected;
|
||||||
|
|
@ -162,12 +158,12 @@ namespace Cosmos.Build.Windows {
|
||||||
aColBegin--;
|
aColBegin--;
|
||||||
aLineEnd--;
|
aLineEnd--;
|
||||||
aColEnd--;
|
aColEnd--;
|
||||||
//Currently can only be called once - need to fix it to reset so it can be called multiple times
|
|
||||||
Run xRunSelected;
|
Run xRunSelected;
|
||||||
|
// Its all on one line
|
||||||
if (aLineBegin == aLineEnd) {
|
if (aLineBegin == aLineEnd) {
|
||||||
xRunSelected = Select(aLineBegin,
|
xRunSelected = Select(aLineBegin, aColBegin, aColEnd - aColBegin);
|
||||||
aColBegin,
|
// Its split across multiple lines so we need to select multiple lines
|
||||||
aColEnd - aColBegin);
|
|
||||||
} else {
|
} else {
|
||||||
xRunSelected = Select(aLineBegin, aColBegin, -1);
|
xRunSelected = Select(aLineBegin, aColBegin, -1);
|
||||||
for (int i = aLineBegin + 1; i <= aLineEnd - 1; i++) {
|
for (int i = aLineBegin + 1; i <= aLineEnd - 1; i++) {
|
||||||
|
|
@ -175,6 +171,7 @@ namespace Cosmos.Build.Windows {
|
||||||
}
|
}
|
||||||
Select(aLineEnd, 0, aColEnd + 1);
|
Select(aLineEnd, 0, aColEnd + 1);
|
||||||
}
|
}
|
||||||
|
// Scroll it into view
|
||||||
fdsvSource.UpdateLayout();
|
fdsvSource.UpdateLayout();
|
||||||
if (xRunSelected != null) {
|
if (xRunSelected != null) {
|
||||||
xRunSelected.PreviousInline.BringIntoView();
|
xRunSelected.PreviousInline.BringIntoView();
|
||||||
|
|
@ -261,13 +258,10 @@ namespace Cosmos.Build.Windows {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
protected void SelectCode(uint aEIP) {
|
protected void SelectCode(uint aEIP) {
|
||||||
var xSourceInfo = mSourceMapping.GetMapping(aEIP);
|
var x = mSourceMapping.GetMapping(aEIP);
|
||||||
if (xSourceInfo != null) {
|
if (x != null) {
|
||||||
LoadSourceFile(xSourceInfo.SourceFile);
|
LoadSourceFile(x.SourceFile);
|
||||||
SelectText(xSourceInfo.Line,
|
SelectText(x.Line, x.Column, x.LineEnd, x.ColumnEnd);
|
||||||
xSourceInfo.Column,
|
|
||||||
xSourceInfo.LineEnd,
|
|
||||||
xSourceInfo.ColumnEnd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue