Skip to content

Commit c401236

Browse files
committed
Imported some debugger fixes from FD5:
Fixed breakpoint paths when there are special characters. Fixed helper method to go to a file line, used when going to breakpoints and frames.
1 parent 9130524 commit c401236

File tree

3 files changed

+30
-46
lines changed

3 files changed

+30
-46
lines changed

External/Plugins/FlashDebugger/Debugger/BreakPointManager.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,15 +321,20 @@ public void Save()
321321
if (m_Project != null)
322322
{
323323
List<BreakPointInfo> bpSaveList = new List<BreakPointInfo>();
324-
Uri u1 = new Uri(m_Project.ProjectPath);
325324
foreach (BreakPointInfo info in m_BreakPointList)
326325
{
327326
if (!info.IsDeleted)
328327
{
329-
Uri u2 = new Uri(u1, info.FileFullPath);
330-
info.FileFullPath = u1.MakeRelativeUri(u2).ToString();
331-
bpSaveList.Add(info);
332-
}
328+
BreakPointInfo infoCopy;
329+
330+
if (!Path.IsPathRooted(info.FileFullPath))
331+
infoCopy = info;
332+
else
333+
infoCopy = new BreakPointInfo(m_Project.GetRelativePath(info.FileFullPath),
334+
info.Line, info.Exp, info.IsDeleted, info.IsEnabled);
335+
336+
bpSaveList.Add(infoCopy);
337+
}
333338
}
334339
Util.SerializeXML<List<BreakPointInfo>>.SaveFile(m_SaveFileFullPath, bpSaveList);
335340
}
@@ -345,8 +350,7 @@ public void Load()
345350
Uri u1 = new Uri(m_Project.ProjectPath);
346351
foreach (BreakPointInfo info in m_BreakPointList)
347352
{
348-
Uri u2 = new Uri(u1, info.FileFullPath);
349-
info.FileFullPath = u2.LocalPath;
353+
info.FileFullPath = m_Project.GetAbsolutePath(info.FileFullPath);
350354
if (ChangeBreakPointEvent != null)
351355
{
352356
ChangeBreakPointEvent(this, new BreakPointArgs(info.FileFullPath, info.Line, info.Exp, info.IsDeleted, info.IsEnabled));

External/Plugins/FlashDebugger/Debugger/DebuggerManager.cs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -605,29 +605,15 @@ private void GotoCurrentLocation(bool bSetMarker)
605605
}
606606
if (CurrentLocation != null && CurrentLocation.getFile() != null)
607607
{
608-
ScintillaControl sci;
609-
String localPath = GetLocalPath(CurrentLocation.getFile());
608+
String localPath = GetLocalPath(CurrentLocation.getFile());
610609
if (localPath != null)
611610
{
612-
sci = ScintillaHelper.GetScintillaControl(localPath);
613-
if (sci == null)
614-
{
615-
PluginBase.MainForm.OpenEditableDocument(localPath);
616-
sci = ScintillaHelper.GetScintillaControl(localPath);
617-
}
618-
if (sci != null)
611+
int line = CurrentLocation.getLine() - 1;
612+
ScintillaControl sci = ScintillaHelper.ActivateDocument(localPath, line, false);
613+
if (sci == null) return;
614+
if (bSetMarker)
619615
{
620-
Int32 i = ScintillaHelper.GetScintillaControlIndex(sci);
621-
if (i != -1)
622-
{
623-
PluginBase.MainForm.Documents[i].Activate();
624-
Int32 line = CurrentLocation.getLine() - 1;
625-
sci.GotoLine(line);
626-
if (bSetMarker)
627-
{
628-
sci.MarkerAdd(line, ScintillaHelper.markerCurrentLine);
629-
}
630-
}
616+
sci.MarkerAdd(line, ScintillaHelper.markerCurrentLine);
631617
}
632618
}
633619
}

External/Plugins/FlashDebugger/Helpers/ScintillaHelper.cs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -321,30 +321,24 @@ static public void ActivateDocument(string filefullpath)
321321
ActivateDocument(filefullpath, -1, false);
322322
}
323323

324-
static public void ActivateDocument(string filefullpath, int line, Boolean bSelectLine)
324+
static public ScintillaControl ActivateDocument(string filefullpath, int line, Boolean bSelectLine)
325325
{
326-
ScintillaControl sci = GetScintillaControl(filefullpath);
327-
if (sci == null)
328-
{
329-
PluginBase.MainForm.OpenEditableDocument(filefullpath);
330-
sci = GetScintillaControl(filefullpath);
331-
}
332-
Int32 i = GetScintillaControlIndex(sci);
333-
if (i != -1)
326+
PluginBase.MainForm.OpenEditableDocument(filefullpath, false);
327+
if (PluginBase.MainForm.CurrentDocument.FileName != filefullpath) return null;
328+
ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl;
329+
if (line >= 0)
334330
{
335-
PluginBase.MainForm.Documents[i].Activate();
336-
if (line >= 0)
331+
sci.EnsureVisible(line);
332+
Int32 start = sci.PositionFromLine(line);
333+
if (bSelectLine)
337334
{
338-
sci.GotoLine(line);
339-
if (bSelectLine)
340-
{
341-
Int32 start = sci.PositionFromLine(line);
342-
Int32 end = start + sci.LineLength(line);
343-
sci.SelectionStart = start;
344-
sci.SelectionEnd = end;
345-
}
335+
Int32 end = start + sci.LineLength(line);
336+
sci.SetSel(start, end);
346337
}
338+
else
339+
sci.SetSel(start, start);
347340
}
341+
return sci;
348342
}
349343

350344
#endregion

0 commit comments

Comments
 (0)