private static void ShowBreakpointSourceLocation(FileLocation location) { if (lastLocation != null && lastLocation.IsSame(location)) { return; } lastLocation = location; ClearDebuggingMarkers(); Npp.PlaceIndicator(INDICATOR_DEBUGSTEP, location.Start, location.End); Npp.PlaceMarker(MARK_DEBUGSTEP, location.Line); int start = Npp.GetFirstVisibleLine(); int end = start + Npp.GetLinesOnScreen(); if (location.Line > end || location.Line < start) { Npp.SetFirstVisibleLine(Math.Max(location.Line - (end - start) / 2, 0)); } Npp.SetCaretPosition(location.Start); Npp.ClearSelection(); //need this one as otherwise parasitic selection can be triggered Win32.SetForegroundWindow(Npp.NppHandle); }
private static void ProcessOpenStackLocation(string sourceLocation) { var location = Debugger.FileLocation.Parse(sourceLocation); int start = Npp.GetFirstVisibleLine(); int end = start + Npp.GetLinesOnScreen(); if (location.Line > end || location.Line < start) { Npp.SetFirstVisibleLine(Math.Max(location.Line - (end - start) / 2, 0)); } Npp.SetCaretPosition(location.Start); Npp.ClearSelection(); //need this one as otherwise parasitic selection can be triggered Win32.SetForegroundWindow(Npp.NppHandle); Win32.SetForegroundWindow(Npp.CurrentScintilla); }
void MembersList_MouseDoubleClick(object sender, MouseEventArgs e) { if (membersList.SelectedItem != null) { var info = (membersList.SelectedItem as MemberInfo); try { membersList.SelectedItem = null; if (info.Line != -1) { Npp.GrabFocus(); int currentLineNum = Npp.GetCaretLineNumber(); int prevLineEnd = Npp.GetLineStart(currentLineNum) - Environment.NewLine.Length; int topScrollOffset = currentLineNum - Npp.GetFirstVisibleLine(); Win32.SendMessage(Npp.CurrentScintilla, SciMsg.SCI_GOTOLINE, info.Line, 0); Npp.SetFirstVisibleLine(info.Line - topScrollOffset); } } catch { } //it is expected to fail if the line does not contain the file content position spec. This is also the reason for not validating any "IndexOf" results. } }