private int GetBlameLine() { if (_blame is null) { return(-1); } Point position = BlameAuthor.PointToClient(MousePosition); int line = BlameAuthor.GetLineFromVisualPosY(position.Y); if (line >= _blame.Lines.Count) { return(-1); } return(line); }
private void BlameAuthor_MouseMove(object sender, MouseEventArgs e) { if (!BlameFile.Focused) { BlameFile.Focus(); } if (_blame is null) { return; } _lineIndex = BlameAuthor.GetLineFromVisualPosY(e.Y); var blameCommit = _lineIndex < _blame.Lines.Count ? _blame.Lines[_lineIndex].Commit : null; HighlightLinesForCommit(blameCommit); if (blameCommit is null) { return; } int newTooltipX = splitContainer2.SplitterDistance + 60; int newTooltipY = e.Y + splitContainer1.SplitterDistance + 20; if (_tooltipCommit != blameCommit || Math.Abs(_lastTooltipX - newTooltipX) > 5 || Math.Abs(_lastTooltipY - newTooltipY) > 5) { _tooltipCommit = blameCommit; _lastTooltipX = newTooltipX; _lastTooltipY = newTooltipY; blameTooltip.Show(blameCommit.ToString(), this, newTooltipX, newTooltipY); } }